Use LockArrayRepository instead of RepositoryInterface to clearly indicate which type of repo it is in some places
parent
6c24e85e54
commit
dd556f989b
|
@ -15,7 +15,7 @@ namespace Composer\DependencyResolver;
|
|||
use Composer\Package\Package;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\RootAliasPackage;
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
use Composer\Repository\LockArrayRepository;
|
||||
use Composer\Semver\Constraint\ConstraintInterface;
|
||||
|
||||
/**
|
||||
|
@ -28,7 +28,7 @@ class Request
|
|||
protected $fixedPackages = array();
|
||||
protected $unlockables = array();
|
||||
|
||||
public function __construct(RepositoryInterface $lockedRepository = null)
|
||||
public function __construct(LockArrayRepository $lockedRepository = null)
|
||||
{
|
||||
$this->lockedRepository = $lockedRepository;
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ class Locker
|
|||
*
|
||||
* @param bool $withDevReqs true to retrieve the locked dev packages
|
||||
* @throws \RuntimeException
|
||||
* @return \Composer\Repository\RepositoryInterface
|
||||
* @return \Composer\Repository\LockArrayRepository
|
||||
*/
|
||||
public function getLockedRepository($withDevReqs = false)
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ class Locker
|
|||
return $packages;
|
||||
}
|
||||
|
||||
throw new \RuntimeException('Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.');
|
||||
throw new \RuntimeException('Your composer.lock is invalid. Run "composer update" to generate a new one.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,6 +19,7 @@ use Composer\Package\BasePackage;
|
|||
use Composer\Package\Version\VersionParser;
|
||||
use Composer\Repository\CompositeRepository;
|
||||
use Composer\Repository\PlatformRepository;
|
||||
use Composer\Repository\LockArrayRepository;
|
||||
use Composer\Semver\Constraint\ConstraintInterface;
|
||||
use Composer\Test\DependencyResolver\PoolTest;
|
||||
|
||||
|
@ -150,14 +151,15 @@ class RepositorySet
|
|||
}
|
||||
|
||||
// TODO unify this with above in some simpler version without "request"?
|
||||
public function createPoolForPackage($packageName)
|
||||
public function createPoolForPackage($packageName, LockArrayRepository $lockedRepo = null)
|
||||
{
|
||||
return $this->createPoolForPackages(array($packageName));
|
||||
return $this->createPoolForPackages(array($packageName), $lockedRepo);
|
||||
}
|
||||
|
||||
public function createPoolForPackages($packageNames)
|
||||
public function createPoolForPackages($packageNames, LockArrayRepository $lockedRepo = null)
|
||||
{
|
||||
$request = new Request();
|
||||
$request = new Request($lockedRepo);
|
||||
|
||||
foreach ($packageNames as $packageName) {
|
||||
$request->install($packageName);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$this->repo->addPackage($packageA = $this->getPackage('A', '1.0'));
|
||||
$this->repositorySet->addRepository($this->repo);
|
||||
|
||||
$pool = $this->repositorySet->createPoolForPackage('A');
|
||||
$pool = $this->repositorySet->createPoolForPackage('A', $this->repoLocked);
|
||||
|
||||
$literals = array($packageA->getId());
|
||||
$expected = array($packageA->getId());
|
||||
|
@ -64,7 +64,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$this->repo->addPackage($packageA2 = $this->getPackage('A', '2.0'));
|
||||
$this->repositorySet->addRepository($this->repo);
|
||||
|
||||
$pool = $this->repositorySet->createPoolForPackage('A');
|
||||
$pool = $this->repositorySet->createPoolForPackage('A', $this->repoLocked);
|
||||
|
||||
$literals = array($packageA1->getId(), $packageA2->getId());
|
||||
$expected = array($packageA2->getId());
|
||||
|
@ -80,7 +80,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$this->repo->addPackage($packageA2 = $this->getPackage('A', '1.0.1-alpha'));
|
||||
$this->repositorySet->addRepository($this->repo);
|
||||
|
||||
$pool = $this->repositorySet->createPoolForPackage('A');
|
||||
$pool = $this->repositorySet->createPoolForPackage('A', $this->repoLocked);
|
||||
|
||||
$literals = array($packageA1->getId(), $packageA2->getId());
|
||||
$expected = array($packageA2->getId());
|
||||
|
@ -96,7 +96,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$this->repo->addPackage($packageA2 = $this->getPackage('A', '1.0.1-alpha'));
|
||||
$this->repositorySet->addRepository($this->repo);
|
||||
|
||||
$pool = $this->repositorySet->createPoolForPackage('A');
|
||||
$pool = $this->repositorySet->createPoolForPackage('A', $this->repoLocked);
|
||||
|
||||
$literals = array($packageA1->getId(), $packageA2->getId());
|
||||
$expected = array($packageA1->getId());
|
||||
|
@ -113,7 +113,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$this->repo->addPackage($packageA2 = $this->getPackage('A', '1.0.0'));
|
||||
$this->repositorySet->addRepository($this->repo);
|
||||
|
||||
$pool = $this->repositorySet->createPoolForPackage('A');
|
||||
$pool = $this->repositorySet->createPoolForPackage('A', $this->repoLocked);
|
||||
|
||||
$literals = array($packageA1->getId(), $packageA2->getId());
|
||||
$expected = array($packageA2->getId());
|
||||
|
@ -136,7 +136,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$this->repositorySet->addRepository($repo1);
|
||||
$this->repositorySet->addRepository($repo2);
|
||||
|
||||
$pool = $this->repositorySet->createPoolForPackage('A');
|
||||
$pool = $this->repositorySet->createPoolForPackage('A', $this->repoLocked);
|
||||
|
||||
$literals = array($package1->getId(), $package2->getId(), $package3->getId(), $package4->getId());
|
||||
$expected = array($package2->getId());
|
||||
|
@ -148,7 +148,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$this->repositorySet->addRepository($repo2);
|
||||
$this->repositorySet->addRepository($repo1);
|
||||
|
||||
$pool = $this->repositorySet->createPoolForPackage('A');
|
||||
$pool = $this->repositorySet->createPoolForPackage('A', $this->repoLocked);
|
||||
|
||||
$expected = array($package4->getId());
|
||||
$selected = $this->policy->selectPreferredPackages($pool, $literals);
|
||||
|
@ -172,7 +172,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$this->repositorySet->addRepository($this->repo);
|
||||
$this->repositorySet->addRepository($this->repoLocked);
|
||||
|
||||
$pool = $this->repositorySet->createPoolForPackage('A');
|
||||
$pool = $this->repositorySet->createPoolForPackage('A', $this->repoLocked);
|
||||
|
||||
$packages = $pool->whatProvides('a', new Constraint('=', '2.1.9999999.9999999-dev'));
|
||||
$literals = array();
|
||||
|
@ -197,7 +197,7 @@ class DefaultPolicyTest extends TestCase
|
|||
|
||||
$this->repositorySet->addRepository($this->repo);
|
||||
|
||||
$pool = $this->repositorySet->createPoolForPackages(array('A', 'B'));
|
||||
$pool = $this->repositorySet->createPoolForPackages(array('A', 'B'), $this->repoLocked);
|
||||
|
||||
$literals = array($packageA->getId(), $packageB->getId());
|
||||
$expected = $literals;
|
||||
|
@ -216,7 +216,7 @@ class DefaultPolicyTest extends TestCase
|
|||
|
||||
$this->repositorySet->addRepository($this->repo);
|
||||
|
||||
$pool = $this->repositorySet->createPoolForPackages(array('A', 'B'));
|
||||
$pool = $this->repositorySet->createPoolForPackages(array('A', 'B'), $this->repoLocked);
|
||||
|
||||
$literals = array($packageA->getId(), $packageB->getId());
|
||||
$expected = $literals;
|
||||
|
@ -237,7 +237,7 @@ class DefaultPolicyTest extends TestCase
|
|||
|
||||
$this->repositorySet->addRepository($this->repo);
|
||||
|
||||
$pool = $this->repositorySet->createPoolForPackages(array('vendor-a/replacer', 'vendor-b/replacer'));
|
||||
$pool = $this->repositorySet->createPoolForPackages(array('vendor-a/replacer', 'vendor-b/replacer'), $this->repoLocked);
|
||||
|
||||
$literals = array($packageA->getId(), $packageB->getId());
|
||||
$expected = $literals;
|
||||
|
@ -253,7 +253,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$repositorySet = new RepositorySet(array(), array(), 'dev');
|
||||
$repositorySet->addRepository($this->repo);
|
||||
|
||||
$pool = $this->repositorySet->createPoolForPackages(array('vendor-a/replacer', 'vendor-b/replacer'));
|
||||
$pool = $this->repositorySet->createPoolForPackages(array('vendor-a/replacer', 'vendor-b/replacer'), $this->repoLocked);
|
||||
|
||||
$literals = array($packageA->getId(), $packageB->getId());
|
||||
$expected = $literals;
|
||||
|
@ -270,7 +270,7 @@ class DefaultPolicyTest extends TestCase
|
|||
$this->repo->addPackage($packageA2 = $this->getPackage('A', '2.0'));
|
||||
$this->repositorySet->addRepository($this->repo);
|
||||
|
||||
$pool = $this->repositorySet->createPoolForPackage('A');
|
||||
$pool = $this->repositorySet->createPoolForPackage('A', $this->repoLocked);
|
||||
|
||||
$literals = array($packageA1->getId(), $packageA2->getId());
|
||||
$expected = array($packageA1->getId());
|
||||
|
|
Loading…
Reference in New Issue