mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Fix tests
This commit is contained in:
parent
c9ef7479c4
commit
73a865bf2a
6 changed files with 58 additions and 22 deletions
|
@ -19,7 +19,7 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
|||
public function testIsLocked()
|
||||
{
|
||||
$json = $this->createJsonFileMock();
|
||||
$locker = new Locker($json, $this->createRepositoryManagerMock(), 'md5');
|
||||
$locker = new Locker($json, $this->createRepositoryManagerMock(), $this->createInstallationManagerMock(), 'md5');
|
||||
|
||||
$json
|
||||
->expects($this->any())
|
||||
|
@ -37,8 +37,9 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$json = $this->createJsonFileMock();
|
||||
$repo = $this->createRepositoryManagerMock();
|
||||
$inst = $this->createInstallationManagerMock();
|
||||
|
||||
$locker = new Locker($json, $repo, 'md5');
|
||||
$locker = new Locker($json, $repo, $inst, 'md5');
|
||||
|
||||
$json
|
||||
->expects($this->once())
|
||||
|
@ -54,8 +55,9 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$json = $this->createJsonFileMock();
|
||||
$repo = $this->createRepositoryManagerMock();
|
||||
$inst = $this->createInstallationManagerMock();
|
||||
|
||||
$locker = new Locker($json, $repo, 'md5');
|
||||
$locker = new Locker($json, $repo, $inst, 'md5');
|
||||
|
||||
$json
|
||||
->expects($this->once())
|
||||
|
@ -87,8 +89,9 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$json = $this->createJsonFileMock();
|
||||
$repo = $this->createRepositoryManagerMock();
|
||||
$inst = $this->createInstallationManagerMock();
|
||||
|
||||
$locker = new Locker($json, $repo, 'md5');
|
||||
$locker = new Locker($json, $repo, $inst, 'md5');
|
||||
|
||||
$json
|
||||
->expects($this->once())
|
||||
|
@ -122,8 +125,9 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$json = $this->createJsonFileMock();
|
||||
$repo = $this->createRepositoryManagerMock();
|
||||
$inst = $this->createInstallationManagerMock();
|
||||
|
||||
$locker = new Locker($json, $repo, 'md5');
|
||||
$locker = new Locker($json, $repo, $inst, 'md5');
|
||||
|
||||
$package1 = $this->createPackageMock();
|
||||
$package2 = $this->createPackageMock();
|
||||
|
@ -168,8 +172,9 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$json = $this->createJsonFileMock();
|
||||
$repo = $this->createRepositoryManagerMock();
|
||||
$inst = $this->createInstallationManagerMock();
|
||||
|
||||
$locker = new Locker($json, $repo, 'md5');
|
||||
$locker = new Locker($json, $repo, $inst, 'md5');
|
||||
|
||||
$package1 = $this->createPackageMock();
|
||||
$package1
|
||||
|
@ -186,8 +191,9 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$json = $this->createJsonFileMock();
|
||||
$repo = $this->createRepositoryManagerMock();
|
||||
$inst = $this->createInstallationManagerMock();
|
||||
|
||||
$locker = new Locker($json, $repo, 'md5');
|
||||
$locker = new Locker($json, $repo, $inst, 'md5');
|
||||
|
||||
$json
|
||||
->expects($this->once())
|
||||
|
@ -201,8 +207,9 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$json = $this->createJsonFileMock();
|
||||
$repo = $this->createRepositoryManagerMock();
|
||||
$inst = $this->createInstallationManagerMock();
|
||||
|
||||
$locker = new Locker($json, $repo, 'md5');
|
||||
$locker = new Locker($json, $repo, $inst, 'md5');
|
||||
|
||||
$json
|
||||
->expects($this->once())
|
||||
|
@ -232,6 +239,15 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
|||
return $mock;
|
||||
}
|
||||
|
||||
private function createInstallationManagerMock()
|
||||
{
|
||||
$mock = $this->getMockBuilder('Composer\Installer\InstallationManager')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
return $mock;
|
||||
}
|
||||
|
||||
private function createPackageMock()
|
||||
{
|
||||
return $this->getMockBuilder('Composer\Package\PackageInterface')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue