1
0
Fork 0

test copied from #5724

pull/5726/head
Rob Bast 2016-09-27 16:59:48 +02:00
parent 8c1f889806
commit 9f2bd34c87
No known key found for this signature in database
GPG Key ID: 73076E35E6165F39
1 changed files with 27 additions and 0 deletions

View File

@ -88,6 +88,33 @@ class VersionSelectorTest extends \PHPUnit_Framework_TestCase
$this->assertSame($package1, $best, 'Latest most stable version should be returned (1.0.0)'); $this->assertSame($package1, $best, 'Latest most stable version should be returned (1.0.0)');
} }
public function testMostStableVersionIsReturnedRegardlessOfOrder()
{
$packageName = 'foobar';
$package1 = $this->createPackage('2.x-dev');
$package2 = $this->createPackage('2.0.0-beta3');
$packages = array($package1, $package2);
$pool = $this->createMockPool();
$pool->expects($this->at(0))
->method('whatProvides')
->with($packageName, null, true)
->will($this->returnValue($packages));
$pool->expects($this->at(1))
->method('whatProvides')
->with($packageName, null, true)
->will($this->returnValue(array_reverse($packages)));
$versionSelector = new VersionSelector($pool);
$best = $versionSelector->findBestCandidate($packageName, null, null);
$this->assertSame($package2, $best, 'Expecting 2.0.0-beta3, cause beta is more stable than dev');
$best = $versionSelector->findBestCandidate($packageName, null, null);
$this->assertSame($package2, $best, 'Expecting 2.0.0-beta3, cause beta is more stable than dev');
}
public function testHighestVersionIsReturned() public function testHighestVersionIsReturned()
{ {
$packageName = 'foobar'; $packageName = 'foobar';