/** * @dataProvider provideValidVersions * @param string $version * @param int $major * @param int $minor * @param int $patch * @param string $pre * @param string $meta * @param string[] $preStack * @param string[] $metaStack */ public function testValidVersion($version, $major, $minor, $patch, $pre, $meta, array $preStack, array $metaStack) { $object = new SemanticVersion($version); $this->assertSame($version, (string) $object); $this->assertSame($version, $object->getVersion()); $this->assertSame($major, $object->getMajor()); $this->assertSame($minor, $object->getMinor()); $this->assertSame($patch, $object->getPatch()); $this->assertSame($pre, $object->getPre()); $this->assertSame($preStack, $object->getPreStack()); $this->assertSame($meta, $object->getMeta()); $this->assertSame($metaStack, $object->getMetaStack()); }
public function testAttributes() { $version = new SemanticVersion('1.0.0-beta+exp.sha.5114f85'); assert('1.0.0-beta+exp.sha.5114f85' === (string) $version); assert(1 === $version->getMajor()); assert(0 === $version->getMinor()); assert(0 === $version->getPatch()); assert('beta' === $version->getPre()); assert('exp.sha.5114f85' === $version->getMeta()); assert('1.0.0-beta+exp.sha.5114f85' === $version->getVersion()); }