/** * @param \DOMElement $element * * @return PharAlias */ private function getPharAliasFromNode(\DOMElement $element) { $parser = new VersionConstraintParser(); if ($element->hasAttribute('version')) { $version = $parser->parse($element->getAttribute('version')); } else { $version = new AnyVersionConstraint(); } return new PharAlias($element->getAttribute('name'), $version); }
/** * @dataProvider versionStringProvider * * @param string $versionString * @param VersionConstraint $expectedConstraint */ public function testReturnsExpectedConstraint($versionString, VersionConstraint $expectedConstraint) { $parser = new VersionConstraintParser(); $this->assertEquals($expectedConstraint, $parser->parse($versionString)); }