|
@@ -25,7 +25,6 @@ class LockerTest extends TestCase
|
|
|
new NullIO,
|
|
|
$json,
|
|
|
$this->createRepositoryManagerMock(),
|
|
|
- $this->createInstallationManagerMock(),
|
|
|
$this->getJsonContent()
|
|
|
);
|
|
|
|
|
@@ -44,10 +43,9 @@ class LockerTest extends TestCase
|
|
|
public function testGetNotLockedPackages()
|
|
|
{
|
|
|
$json = $this->createJsonFileMock();
|
|
|
- $repo = $this->createRepositoryManagerMock();
|
|
|
$inst = $this->createInstallationManagerMock();
|
|
|
|
|
|
- $locker = new Locker(new NullIO, $json, $repo, $inst, $this->getJsonContent());
|
|
|
+ $locker = new Locker(new NullIO, $json, $inst, $this->getJsonContent());
|
|
|
|
|
|
$json
|
|
|
->expects($this->once())
|
|
@@ -62,10 +60,9 @@ class LockerTest extends TestCase
|
|
|
public function testGetLockedPackages()
|
|
|
{
|
|
|
$json = $this->createJsonFileMock();
|
|
|
- $repo = $this->createRepositoryManagerMock();
|
|
|
$inst = $this->createInstallationManagerMock();
|
|
|
|
|
|
- $locker = new Locker(new NullIO, $json, $repo, $inst, $this->getJsonContent());
|
|
|
+ $locker = new Locker(new NullIO, $json, $inst, $this->getJsonContent());
|
|
|
|
|
|
$json
|
|
|
->expects($this->once())
|
|
@@ -89,11 +86,10 @@ class LockerTest extends TestCase
|
|
|
public function testSetLockData()
|
|
|
{
|
|
|
$json = $this->createJsonFileMock();
|
|
|
- $repo = $this->createRepositoryManagerMock();
|
|
|
$inst = $this->createInstallationManagerMock();
|
|
|
|
|
|
$jsonContent = $this->getJsonContent() . ' ';
|
|
|
- $locker = new Locker(new NullIO, $json, $repo, $inst, $jsonContent);
|
|
|
+ $locker = new Locker(new NullIO, $json, $inst, $jsonContent);
|
|
|
|
|
|
$package1 = $this->createPackageMock();
|
|
|
$package2 = $this->createPackageMock();
|
|
@@ -162,10 +158,9 @@ class LockerTest extends TestCase
|
|
|
public function testLockBadPackages()
|
|
|
{
|
|
|
$json = $this->createJsonFileMock();
|
|
|
- $repo = $this->createRepositoryManagerMock();
|
|
|
$inst = $this->createInstallationManagerMock();
|
|
|
|
|
|
- $locker = new Locker(new NullIO, $json, $repo, $inst, $this->getJsonContent());
|
|
|
+ $locker = new Locker(new NullIO, $json, $inst, $this->getJsonContent());
|
|
|
|
|
|
$package1 = $this->createPackageMock();
|
|
|
$package1
|
|
@@ -181,11 +176,10 @@ class LockerTest extends TestCase
|
|
|
public function testIsFresh()
|
|
|
{
|
|
|
$json = $this->createJsonFileMock();
|
|
|
- $repo = $this->createRepositoryManagerMock();
|
|
|
$inst = $this->createInstallationManagerMock();
|
|
|
|
|
|
$jsonContent = $this->getJsonContent();
|
|
|
- $locker = new Locker(new NullIO, $json, $repo, $inst, $jsonContent);
|
|
|
+ $locker = new Locker(new NullIO, $json, $inst, $jsonContent);
|
|
|
|
|
|
$json
|
|
|
->expects($this->once())
|
|
@@ -198,10 +192,9 @@ class LockerTest extends TestCase
|
|
|
public function testIsFreshFalse()
|
|
|
{
|
|
|
$json = $this->createJsonFileMock();
|
|
|
- $repo = $this->createRepositoryManagerMock();
|
|
|
$inst = $this->createInstallationManagerMock();
|
|
|
|
|
|
- $locker = new Locker(new NullIO, $json, $repo, $inst, $this->getJsonContent());
|
|
|
+ $locker = new Locker(new NullIO, $json, $inst, $this->getJsonContent());
|
|
|
|
|
|
$json
|
|
|
->expects($this->once())
|
|
@@ -214,11 +207,10 @@ class LockerTest extends TestCase
|
|
|
public function testIsFreshWithContentHash()
|
|
|
{
|
|
|
$json = $this->createJsonFileMock();
|
|
|
- $repo = $this->createRepositoryManagerMock();
|
|
|
$inst = $this->createInstallationManagerMock();
|
|
|
|
|
|
$jsonContent = $this->getJsonContent();
|
|
|
- $locker = new Locker(new NullIO, $json, $repo, $inst, $jsonContent);
|
|
|
+ $locker = new Locker(new NullIO, $json, $inst, $jsonContent);
|
|
|
|
|
|
$json
|
|
|
->expects($this->once())
|
|
@@ -231,11 +223,10 @@ class LockerTest extends TestCase
|
|
|
public function testIsFreshWithContentHashAndNoHash()
|
|
|
{
|
|
|
$json = $this->createJsonFileMock();
|
|
|
- $repo = $this->createRepositoryManagerMock();
|
|
|
$inst = $this->createInstallationManagerMock();
|
|
|
|
|
|
$jsonContent = $this->getJsonContent();
|
|
|
- $locker = new Locker(new NullIO, $json, $repo, $inst, $jsonContent);
|
|
|
+ $locker = new Locker(new NullIO, $json, $inst, $jsonContent);
|
|
|
|
|
|
$json
|
|
|
->expects($this->once())
|
|
@@ -248,10 +239,9 @@ class LockerTest extends TestCase
|
|
|
public function testIsFreshFalseWithContentHash()
|
|
|
{
|
|
|
$json = $this->createJsonFileMock();
|
|
|
- $repo = $this->createRepositoryManagerMock();
|
|
|
$inst = $this->createInstallationManagerMock();
|
|
|
|
|
|
- $locker = new Locker(new NullIO, $json, $repo, $inst, $this->getJsonContent());
|
|
|
+ $locker = new Locker(new NullIO, $json, $inst, $this->getJsonContent());
|
|
|
|
|
|
$differentHash = md5($this->getJsonContent(array('name' => 'test2')));
|
|
|
|
|
@@ -269,20 +259,7 @@ class LockerTest extends TestCase
|
|
|
->disableOriginalConstructor()
|
|
|
->getMock();
|
|
|
}
|
|
|
-
|
|
|
- private function createRepositoryManagerMock()
|
|
|
- {
|
|
|
- $mock = $this->getMockBuilder('Composer\Repository\RepositoryManager')
|
|
|
- ->disableOriginalConstructor()
|
|
|
- ->getMock();
|
|
|
-
|
|
|
- $mock->expects($this->any())
|
|
|
- ->method('getLocalRepository')
|
|
|
- ->will($this->returnValue($this->getMockBuilder('Composer\Repository\ArrayRepository')->getMock()));
|
|
|
-
|
|
|
- return $mock;
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
private function createInstallationManagerMock()
|
|
|
{
|
|
|
$mock = $this->getMockBuilder('Composer\Installer\InstallationManager')
|