Merge pull request #6942 from localheinz/fix/unused
Fix: Remove unused parameter and fieldpull/8295/head
commit
203f972ed7
|
@ -392,7 +392,7 @@ class Factory
|
||||||
? substr($composerFile, 0, -4).'lock'
|
? substr($composerFile, 0, -4).'lock'
|
||||||
: $composerFile . '.lock';
|
: $composerFile . '.lock';
|
||||||
|
|
||||||
$locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
|
$locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $im, file_get_contents($composerFile));
|
||||||
$composer->setLocker($locker);
|
$composer->setLocker($locker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,6 @@ class Locker
|
||||||
{
|
{
|
||||||
/** @var JsonFile */
|
/** @var JsonFile */
|
||||||
private $lockFile;
|
private $lockFile;
|
||||||
/** @var RepositoryManager */
|
|
||||||
private $repositoryManager;
|
|
||||||
/** @var InstallationManager */
|
/** @var InstallationManager */
|
||||||
private $installationManager;
|
private $installationManager;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
|
@ -54,14 +52,12 @@ class Locker
|
||||||
*
|
*
|
||||||
* @param IOInterface $io
|
* @param IOInterface $io
|
||||||
* @param JsonFile $lockFile lockfile loader
|
* @param JsonFile $lockFile lockfile loader
|
||||||
* @param RepositoryManager $repositoryManager repository manager instance
|
|
||||||
* @param InstallationManager $installationManager installation manager instance
|
* @param InstallationManager $installationManager installation manager instance
|
||||||
* @param string $composerFileContents The contents of the composer file
|
* @param string $composerFileContents The contents of the composer file
|
||||||
*/
|
*/
|
||||||
public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
|
public function __construct(IOInterface $io, JsonFile $lockFile, InstallationManager $installationManager, $composerFileContents)
|
||||||
{
|
{
|
||||||
$this->lockFile = $lockFile;
|
$this->lockFile = $lockFile;
|
||||||
$this->repositoryManager = $repositoryManager;
|
|
||||||
$this->installationManager = $installationManager;
|
$this->installationManager = $installationManager;
|
||||||
$this->hash = md5($composerFileContents);
|
$this->hash = md5($composerFileContents);
|
||||||
$this->contentHash = self::getContentHash($composerFileContents);
|
$this->contentHash = self::getContentHash($composerFileContents);
|
||||||
|
|
|
@ -202,7 +202,7 @@ class InstallerTest extends TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
$contents = json_encode($composerConfig);
|
$contents = json_encode($composerConfig);
|
||||||
$locker = new Locker($io, $lockJsonMock, $repositoryManager, $composer->getInstallationManager(), $contents);
|
$locker = new Locker($io, $lockJsonMock, $composer->getInstallationManager(), $contents);
|
||||||
$composer->setLocker($locker);
|
$composer->setLocker($locker);
|
||||||
|
|
||||||
$eventDispatcher = $this->getMockBuilder('Composer\EventDispatcher\EventDispatcher')->disableOriginalConstructor()->getMock();
|
$eventDispatcher = $this->getMockBuilder('Composer\EventDispatcher\EventDispatcher')->disableOriginalConstructor()->getMock();
|
||||||
|
|
|
@ -25,7 +25,6 @@ class LockerTest extends TestCase
|
||||||
new NullIO,
|
new NullIO,
|
||||||
$json,
|
$json,
|
||||||
$this->createRepositoryManagerMock(),
|
$this->createRepositoryManagerMock(),
|
||||||
$this->createInstallationManagerMock(),
|
|
||||||
$this->getJsonContent()
|
$this->getJsonContent()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -44,10 +43,9 @@ class LockerTest extends TestCase
|
||||||
public function testGetNotLockedPackages()
|
public function testGetNotLockedPackages()
|
||||||
{
|
{
|
||||||
$json = $this->createJsonFileMock();
|
$json = $this->createJsonFileMock();
|
||||||
$repo = $this->createRepositoryManagerMock();
|
|
||||||
$inst = $this->createInstallationManagerMock();
|
$inst = $this->createInstallationManagerMock();
|
||||||
|
|
||||||
$locker = new Locker(new NullIO, $json, $repo, $inst, $this->getJsonContent());
|
$locker = new Locker(new NullIO, $json, $inst, $this->getJsonContent());
|
||||||
|
|
||||||
$json
|
$json
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
|
@ -62,10 +60,9 @@ class LockerTest extends TestCase
|
||||||
public function testGetLockedPackages()
|
public function testGetLockedPackages()
|
||||||
{
|
{
|
||||||
$json = $this->createJsonFileMock();
|
$json = $this->createJsonFileMock();
|
||||||
$repo = $this->createRepositoryManagerMock();
|
|
||||||
$inst = $this->createInstallationManagerMock();
|
$inst = $this->createInstallationManagerMock();
|
||||||
|
|
||||||
$locker = new Locker(new NullIO, $json, $repo, $inst, $this->getJsonContent());
|
$locker = new Locker(new NullIO, $json, $inst, $this->getJsonContent());
|
||||||
|
|
||||||
$json
|
$json
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
|
@ -89,11 +86,10 @@ class LockerTest extends TestCase
|
||||||
public function testSetLockData()
|
public function testSetLockData()
|
||||||
{
|
{
|
||||||
$json = $this->createJsonFileMock();
|
$json = $this->createJsonFileMock();
|
||||||
$repo = $this->createRepositoryManagerMock();
|
|
||||||
$inst = $this->createInstallationManagerMock();
|
$inst = $this->createInstallationManagerMock();
|
||||||
|
|
||||||
$jsonContent = $this->getJsonContent() . ' ';
|
$jsonContent = $this->getJsonContent() . ' ';
|
||||||
$locker = new Locker(new NullIO, $json, $repo, $inst, $jsonContent);
|
$locker = new Locker(new NullIO, $json, $inst, $jsonContent);
|
||||||
|
|
||||||
$package1 = $this->createPackageMock();
|
$package1 = $this->createPackageMock();
|
||||||
$package2 = $this->createPackageMock();
|
$package2 = $this->createPackageMock();
|
||||||
|
@ -162,10 +158,9 @@ class LockerTest extends TestCase
|
||||||
public function testLockBadPackages()
|
public function testLockBadPackages()
|
||||||
{
|
{
|
||||||
$json = $this->createJsonFileMock();
|
$json = $this->createJsonFileMock();
|
||||||
$repo = $this->createRepositoryManagerMock();
|
|
||||||
$inst = $this->createInstallationManagerMock();
|
$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 = $this->createPackageMock();
|
||||||
$package1
|
$package1
|
||||||
|
@ -181,11 +176,10 @@ class LockerTest extends TestCase
|
||||||
public function testIsFresh()
|
public function testIsFresh()
|
||||||
{
|
{
|
||||||
$json = $this->createJsonFileMock();
|
$json = $this->createJsonFileMock();
|
||||||
$repo = $this->createRepositoryManagerMock();
|
|
||||||
$inst = $this->createInstallationManagerMock();
|
$inst = $this->createInstallationManagerMock();
|
||||||
|
|
||||||
$jsonContent = $this->getJsonContent();
|
$jsonContent = $this->getJsonContent();
|
||||||
$locker = new Locker(new NullIO, $json, $repo, $inst, $jsonContent);
|
$locker = new Locker(new NullIO, $json, $inst, $jsonContent);
|
||||||
|
|
||||||
$json
|
$json
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
|
@ -198,10 +192,9 @@ class LockerTest extends TestCase
|
||||||
public function testIsFreshFalse()
|
public function testIsFreshFalse()
|
||||||
{
|
{
|
||||||
$json = $this->createJsonFileMock();
|
$json = $this->createJsonFileMock();
|
||||||
$repo = $this->createRepositoryManagerMock();
|
|
||||||
$inst = $this->createInstallationManagerMock();
|
$inst = $this->createInstallationManagerMock();
|
||||||
|
|
||||||
$locker = new Locker(new NullIO, $json, $repo, $inst, $this->getJsonContent());
|
$locker = new Locker(new NullIO, $json, $inst, $this->getJsonContent());
|
||||||
|
|
||||||
$json
|
$json
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
|
@ -214,11 +207,10 @@ class LockerTest extends TestCase
|
||||||
public function testIsFreshWithContentHash()
|
public function testIsFreshWithContentHash()
|
||||||
{
|
{
|
||||||
$json = $this->createJsonFileMock();
|
$json = $this->createJsonFileMock();
|
||||||
$repo = $this->createRepositoryManagerMock();
|
|
||||||
$inst = $this->createInstallationManagerMock();
|
$inst = $this->createInstallationManagerMock();
|
||||||
|
|
||||||
$jsonContent = $this->getJsonContent();
|
$jsonContent = $this->getJsonContent();
|
||||||
$locker = new Locker(new NullIO, $json, $repo, $inst, $jsonContent);
|
$locker = new Locker(new NullIO, $json, $inst, $jsonContent);
|
||||||
|
|
||||||
$json
|
$json
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
|
@ -231,11 +223,10 @@ class LockerTest extends TestCase
|
||||||
public function testIsFreshWithContentHashAndNoHash()
|
public function testIsFreshWithContentHashAndNoHash()
|
||||||
{
|
{
|
||||||
$json = $this->createJsonFileMock();
|
$json = $this->createJsonFileMock();
|
||||||
$repo = $this->createRepositoryManagerMock();
|
|
||||||
$inst = $this->createInstallationManagerMock();
|
$inst = $this->createInstallationManagerMock();
|
||||||
|
|
||||||
$jsonContent = $this->getJsonContent();
|
$jsonContent = $this->getJsonContent();
|
||||||
$locker = new Locker(new NullIO, $json, $repo, $inst, $jsonContent);
|
$locker = new Locker(new NullIO, $json, $inst, $jsonContent);
|
||||||
|
|
||||||
$json
|
$json
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
|
@ -248,10 +239,9 @@ class LockerTest extends TestCase
|
||||||
public function testIsFreshFalseWithContentHash()
|
public function testIsFreshFalseWithContentHash()
|
||||||
{
|
{
|
||||||
$json = $this->createJsonFileMock();
|
$json = $this->createJsonFileMock();
|
||||||
$repo = $this->createRepositoryManagerMock();
|
|
||||||
$inst = $this->createInstallationManagerMock();
|
$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')));
|
$differentHash = md5($this->getJsonContent(array('name' => 'test2')));
|
||||||
|
|
||||||
|
@ -270,19 +260,6 @@ class LockerTest extends TestCase
|
||||||
->getMock();
|
->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()
|
private function createInstallationManagerMock()
|
||||||
{
|
{
|
||||||
$mock = $this->getMockBuilder('Composer\Installer\InstallationManager')
|
$mock = $this->getMockBuilder('Composer\Installer\InstallationManager')
|
||||||
|
|
Loading…
Reference in New Issue