mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Add support for hyphen ranges
This commit is contained in:
parent
69ef80124f
commit
ebab9db27a
3 changed files with 60 additions and 4 deletions
|
@ -294,6 +294,33 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider hyphenConstraints
|
||||
*/
|
||||
public function testParseHyphen($input, $min, $max)
|
||||
{
|
||||
$parser = new VersionParser;
|
||||
if ($min) {
|
||||
$expected = new MultiConstraint(array($min, $max));
|
||||
} else {
|
||||
$expected = $max;
|
||||
}
|
||||
|
||||
$this->assertSame((string) $expected, (string) $parser->parseConstraints($input));
|
||||
}
|
||||
|
||||
public function hyphenConstraints()
|
||||
{
|
||||
return array(
|
||||
array('1 - 2', new VersionConstraint('>=', '1.0.0.0-dev'), new VersionConstraint('<', '3.0.0.0-dev')),
|
||||
array('1.2.3 - 2.3.4.5', new VersionConstraint('>=', '1.2.3.0-dev'), new VersionConstraint('<=', '2.3.4.5')),
|
||||
array('1.2-beta - 2.3', new VersionConstraint('>=', '1.2.0.0-beta'), new VersionConstraint('<', '2.4.0.0-dev')),
|
||||
array('1.2-beta - 2.3-dev', new VersionConstraint('>=', '1.2.0.0-beta'), new VersionConstraint('<=', '2.3.0.0-dev')),
|
||||
array('1.2-RC - 2.3.1', new VersionConstraint('>=', '1.2.0.0-RC'), new VersionConstraint('<=', '2.3.1.0')),
|
||||
array('1.2.3-alpha - 2.3-RC', new VersionConstraint('>=', '1.2.3.0-alpha'), new VersionConstraint('<=', '2.3.0.0-RC')),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider multiConstraintProvider
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue