1
0
Fork 0

Search only for packages from the local repository in the locker

pull/77/merge
Jordi Boggiano 2011-10-30 20:29:52 +01:00
parent 1ca3e5e5e2
commit 36a724fa51
2 changed files with 10 additions and 4 deletions

View File

@ -61,7 +61,7 @@ class Locker
$lockList = $this->lockFile->read(); $lockList = $this->lockFile->read();
$packages = array(); $packages = array();
foreach ($lockList as $info) { foreach ($lockList as $info) {
$package = $this->repositoryManager->findPackage($info['package'], $info['version']); $package = $this->repositoryManager->getLocalRepository()->findPackage($info['package'], $info['version']);
if (!$package) { if (!$package) {
throw new \LogicException(sprintf( throw new \LogicException(sprintf(

View File

@ -68,7 +68,7 @@ class LockerTest extends \PHPUnit_Framework_TestCase
$package1 = $this->createPackageMock(); $package1 = $this->createPackageMock();
$package2 = $this->createPackageMock(); $package2 = $this->createPackageMock();
$repo $repo->getLocalRepository()
->expects($this->exactly(2)) ->expects($this->exactly(2))
->method('findPackage') ->method('findPackage')
->with($this->logicalOr('pkg1', 'pkg2'), $this->logicalOr('1.0.0-beta', '0.1.10')) ->with($this->logicalOr('pkg1', 'pkg2'), $this->logicalOr('1.0.0-beta', '0.1.10'))
@ -99,7 +99,7 @@ class LockerTest extends \PHPUnit_Framework_TestCase
$package1 = $this->createPackageMock(); $package1 = $this->createPackageMock();
$package2 = $this->createPackageMock(); $package2 = $this->createPackageMock();
$repo $repo->getLocalRepository()
->expects($this->exactly(2)) ->expects($this->exactly(2))
->method('findPackage') ->method('findPackage')
->with($this->logicalOr('pkg1', 'pkg2'), $this->logicalOr('1.0.0-beta', '0.1.10')) ->with($this->logicalOr('pkg1', 'pkg2'), $this->logicalOr('1.0.0-beta', '0.1.10'))
@ -176,9 +176,15 @@ class LockerTest extends \PHPUnit_Framework_TestCase
private function createRepositoryManagerMock() private function createRepositoryManagerMock()
{ {
return $this->getMockBuilder('Composer\Repository\RepositoryManager') $mock = $this->getMockBuilder('Composer\Repository\RepositoryManager')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$mock->expects($this->any())
->method('getLocalRepository')
->will($this->returnValue($this->getMockBuilder('Composer\Repository\ArrayRepository')->getMock()));
return $mock;
} }
private function createPackageMock() private function createPackageMock()