mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Add test for Pool handling and refactor a couple things
This commit is contained in:
parent
0936670213
commit
453b9a616b
6 changed files with 41 additions and 11 deletions
|
@ -14,6 +14,7 @@ namespace Composer\Test\DependencyResolver;
|
|||
|
||||
use Composer\DependencyResolver\Pool;
|
||||
use Composer\Repository\ArrayRepository;
|
||||
use Composer\Package\BasePackage;
|
||||
use Composer\Test\TestCase;
|
||||
|
||||
class PoolTest extends TestCase
|
||||
|
@ -31,6 +32,22 @@ class PoolTest extends TestCase
|
|||
$this->assertEquals(array($package), $pool->whatProvides('foo'));
|
||||
}
|
||||
|
||||
public function testPoolIgnoresIrrelevantPackages()
|
||||
{
|
||||
$pool = new Pool('stable', array('bar' => BasePackage::STABILITY_BETA));
|
||||
$repo = new ArrayRepository;
|
||||
$repo->addPackage($package = $this->getPackage('bar', '1'));
|
||||
$repo->addPackage($betaPackage = $this->getPackage('bar', '1-beta'));
|
||||
$repo->addPackage($alphaPackage = $this->getPackage('bar', '1-alpha'));
|
||||
$repo->addPackage($package2 = $this->getPackage('foo', '1'));
|
||||
$repo->addPackage($rcPackage2 = $this->getPackage('foo', '1rc'));
|
||||
|
||||
$pool->addRepository($repo);
|
||||
|
||||
$this->assertEquals(array($package, $betaPackage), $pool->whatProvides('bar'));
|
||||
$this->assertEquals(array($package2), $pool->whatProvides('foo'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue