Ignore references when parsing dev versions
parent
ba29b4bf94
commit
c10eb66ac4
|
@ -33,6 +33,8 @@ class VersionParser
|
|||
*/
|
||||
static public function parseStability($version)
|
||||
{
|
||||
$version = preg_replace('{#[a-f0-9]+$}i', '', $version);
|
||||
|
||||
if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
|
||||
return 'dev';
|
||||
}
|
||||
|
@ -155,6 +157,10 @@ class VersionParser
|
|||
$constraints = empty($match[1]) ? '*' : $match[1];
|
||||
}
|
||||
|
||||
if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#[a-f0-9]+$}i', $constraints, $match)) {
|
||||
$constraints = $match[1];
|
||||
}
|
||||
|
||||
$constraints = preg_split('{\s*,\s*}', trim($constraints));
|
||||
|
||||
if (count($constraints) > 1) {
|
||||
|
|
|
@ -112,6 +112,21 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertSame((string) new VersionConstraint('=', '1.0.0.0'), (string) $parser->parseConstraints('1.0@dev'));
|
||||
}
|
||||
|
||||
public function testParseConstraintsIgnoresReferenceOnDevVersion()
|
||||
{
|
||||
$parser = new VersionParser;
|
||||
$this->assertSame((string) new VersionConstraint('=', '1.0.9999999.9999999-dev'), (string) $parser->parseConstraints('1.0.x-dev#abcd123'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException UnexpectedValueException
|
||||
*/
|
||||
public function testParseConstraintsFailsOnBadReference()
|
||||
{
|
||||
$parser = new VersionParser;
|
||||
$this->assertSame((string) new VersionConstraint('=', '1.0.0.0'), (string) $parser->parseConstraints('1.0#abcd123'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider simpleConstraints
|
||||
*/
|
||||
|
@ -213,6 +228,7 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase
|
|||
return array(
|
||||
array('stable', '1.0'),
|
||||
array('dev', 'v2.0.x-dev'),
|
||||
array('dev', 'v2.0.x-dev#abc123'),
|
||||
array('RC', '3.0-RC2'),
|
||||
array('dev', 'dev-master'),
|
||||
array('dev', '3.1.2-dev'),
|
||||
|
|
Loading…
Reference in New Issue