1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Only compare branches as versions in the policy to sort packages, but not in the solver, fixes #1817

This commit is contained in:
Jordi Boggiano 2013-05-23 18:12:54 +02:00
parent 950fc7e66e
commit e848c76cbc
4 changed files with 44 additions and 6 deletions

View file

@ -72,6 +72,8 @@ class VersionConstraintTest extends \PHPUnit_Framework_TestCase
array('==', 'dev-foo-bist', '==', 'dev-foo-aist'),
array('<=', 'dev-foo-bist', '>=', 'dev-foo-aist'),
array('>=', 'dev-foo-bist', '<', 'dev-foo-aist'),
array('<', '0.12', '==', 'dev-foo'), // branches are not comparable
array('>', '0.12', '==', 'dev-foo'), // branches are not comparable
);
}
@ -85,4 +87,19 @@ class VersionConstraintTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($versionRequire->matches($versionProvide));
}
public function testComparableBranches()
{
$versionRequire = new VersionConstraint('>', '0.12');
$versionProvide = new VersionConstraint('==', 'dev-foo');
$this->assertFalse($versionRequire->matches($versionProvide));
$this->assertFalse($versionRequire->matchSpecific($versionProvide, true));
$versionRequire = new VersionConstraint('<', '0.12');
$versionProvide = new VersionConstraint('==', 'dev-foo');
$this->assertFalse($versionRequire->matches($versionProvide));
$this->assertTrue($versionRequire->matchSpecific($versionProvide, true));
}
}