partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

UnitTest.php (824B)


      1 <?php
      2 
      3 namespace PartKeepr\UnitBundle\Tests\Model;
      4 
      5 use PartKeepr\SiPrefixBundle\Entity\SiPrefix;
      6 use PartKeepr\UnitBundle\Entity\Unit;
      7 
      8 class UnitTest extends \PHPUnit_Framework_TestCase
      9 {
     10     public function testName()
     11     {
     12         $unit = $this->getUnit();
     13 
     14         $unit->setName('Volt');
     15         $this->assertEquals('Volt', $unit->getName());
     16     }
     17 
     18     public function testSymbol()
     19     {
     20         $unit = $this->getUnit();
     21 
     22         $unit->setSymbol('V');
     23 
     24         $this->assertEquals('V', $unit->getSymbol());
     25     }
     26 
     27     public function testPrefixes()
     28     {
     29         $unit = $this->getUnit();
     30         $newSiPrefix = new SiPrefix();
     31 
     32         $unit->addPrefix($newSiPrefix);
     33         $this->assertEquals([$newSiPrefix], $unit->getPrefixes());
     34     }
     35 
     36     private function getUnit()
     37     {
     38         return new Unit();
     39     }
     40 }