Beispiel #1
0
 /**
  * Test version.
  */
 public function testVersion()
 {
     $this->given($version = Version::fromString('1.0'))->then()->integer($version->major())->isEqualTo(1)->integer($version->minor())->isEqualTo(0)->integer($version->patch())->isEqualTo(0);
     $this->given($version = Version::fromString('3.0.9.1'))->then()->integer($version->major())->isEqualTo(3)->integer($version->minor())->isEqualTo(0)->integer($version->patch())->isEqualTo(9)->string($version->__toString())->isEqualTo('3.0.9');
     $this->given($version = new Version(0, 145, 324))->then()->integer($version->major())->isEqualTo(0)->integer($version->minor())->isEqualTo(145)->integer($version->patch())->isEqualTo(324)->and()->when($version->increment(VersionIncrementType::MAJOR()))->then()->integer($version->major())->isEqualTo(1)->integer($version->minor())->isEqualTo(0)->integer($version->patch())->isEqualTo(0)->boolean($version->isMajorVersion())->isTrue()->boolean($version->isMinorVersion())->isFalse()->and()->given($version = new Version(0, 145, 324))->when($version->increment(VersionIncrementType::MINOR()))->then()->integer($version->minor())->isEqualTo(146)->integer($version->patch())->isEqualTo(0)->boolean($version->isMajorVersion())->isFalse()->boolean($version->isMinorVersion())->isTrue()->and()->given($version = new Version(0, 145, 324))->when($version->increment(VersionIncrementType::PATCH()))->then()->integer($version->patch())->isEqualTo(325)->boolean($version->isMajorVersion())->isFalse()->boolean($version->isMinorVersion())->isFalse()->and()->when($version->setMinor(657))->then()->integer($version->minor())->isEqualTo(657)->and()->when($version->setPatch(54))->then()->integer($version->patch())->isEqualTo(54);
 }