コード例 #1
0
 public function testSelectLocalReposFirst()
 {
     $this->repoImportant = new ArrayRepository();
     $this->repo->addPackage($packageA = $this->getPackage('A', 'dev-master'));
     $this->repo->addPackage($packageAAlias = new AliasPackage($packageA, '2.1.9999999.9999999-dev', '2.1.x-dev'));
     $this->repoImportant->addPackage($packageAImportant = $this->getPackage('A', 'dev-feature-a'));
     $this->repoImportant->addPackage($packageAAliasImportant = new AliasPackage($packageAImportant, '2.1.9999999.9999999-dev', '2.1.x-dev'));
     $this->repoImportant->addPackage($packageA2Important = $this->getPackage('A', 'dev-master'));
     $this->repoImportant->addPackage($packageA2AliasImportant = new AliasPackage($packageA2Important, '2.1.9999999.9999999-dev', '2.1.x-dev'));
     $packageAAliasImportant->setRootPackageAlias(true);
     $this->pool->addRepository($this->repoInstalled);
     $this->pool->addRepository($this->repoImportant);
     $this->pool->addRepository($this->repo);
     $packages = $this->pool->whatProvides('a', new Constraint('=', '2.1.9999999.9999999-dev'));
     $literals = array();
     foreach ($packages as $package) {
         $literals[] = $package->getId();
     }
     $expected = array($packageAAliasImportant->getId());
     $selected = $this->policy->selectPreferredPackages($this->pool, array(), $literals);
     $this->assertEquals($expected, $selected);
 }