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

Follow stability option in create-project to select the best possible version, refs #4563

This commit is contained in:
Jordi Boggiano 2015-11-14 15:04:04 +00:00
parent adc0bbeeb9
commit 4b269f4ded
3 changed files with 39 additions and 4 deletions

View file

@ -103,7 +103,28 @@ class VersionSelectorTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue($packages));
$versionSelector = new VersionSelector($pool);
$best = $versionSelector->findBestCandidate($packageName, null, null, false);
$best = $versionSelector->findBestCandidate($packageName, null, null, 'dev');
$this->assertSame($package2, $best, 'Latest version should be returned (1.1.0-beta)');
}
public function testHighestVersionMatchingStabilityIsReturned()
{
$packageName = 'foobar';
$package1 = $this->createPackage('1.0.0');
$package2 = $this->createPackage('1.1.0-beta');
$package3 = $this->createPackage('1.2.0-alpha');
$packages = array($package1, $package2, $package3);
$pool = $this->createMockPool();
$pool->expects($this->once())
->method('whatProvides')
->with($packageName, null, true)
->will($this->returnValue($packages));
$versionSelector = new VersionSelector($pool);
$best = $versionSelector->findBestCandidate($packageName, null, null, 'beta');
$this->assertSame($package2, $best, 'Latest version should be returned (1.1.0-beta)');
}