|
|
@ -118,7 +118,6 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
|
|
|
->method('getVersion')
|
|
|
|
->method('getVersion')
|
|
|
|
->will($this->returnValue('0.1.10.0'));
|
|
|
|
->will($this->returnValue('0.1.10.0'));
|
|
|
|
|
|
|
|
|
|
|
|
$hash = md5($jsonContent);
|
|
|
|
|
|
|
|
$contentHash = md5(trim($jsonContent));
|
|
|
|
$contentHash = md5(trim($jsonContent));
|
|
|
|
|
|
|
|
|
|
|
|
$json
|
|
|
|
$json
|
|
|
@ -128,7 +127,6 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
|
|
|
'_readme' => array('This file locks the dependencies of your project to a known state',
|
|
|
|
'_readme' => array('This file locks the dependencies of your project to a known state',
|
|
|
|
'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file',
|
|
|
|
'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file',
|
|
|
|
'This file is @gener'.'ated automatically', ),
|
|
|
|
'This file is @gener'.'ated automatically', ),
|
|
|
|
'hash' => $hash,
|
|
|
|
|
|
|
|
'content-hash' => $contentHash,
|
|
|
|
'content-hash' => $contentHash,
|
|
|
|
'packages' => array(
|
|
|
|
'packages' => array(
|
|
|
|
array('name' => 'pkg1', 'version' => '1.0.0-beta'),
|
|
|
|
array('name' => 'pkg1', 'version' => '1.0.0-beta'),
|
|
|
@ -217,6 +215,23 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
|
|
|
$this->assertTrue($locker->isFresh());
|
|
|
|
$this->assertTrue($locker->isFresh());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function testIsFreshWithContentHashAndNoHash()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$json = $this->createJsonFileMock();
|
|
|
|
|
|
|
|
$repo = $this->createRepositoryManagerMock();
|
|
|
|
|
|
|
|
$inst = $this->createInstallationManagerMock();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$jsonContent = $this->getJsonContent();
|
|
|
|
|
|
|
|
$locker = new Locker(new NullIO, $json, $repo, $inst, $jsonContent);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$json
|
|
|
|
|
|
|
|
->expects($this->once())
|
|
|
|
|
|
|
|
->method('read')
|
|
|
|
|
|
|
|
->will($this->returnValue(array('content-hash' => md5($jsonContent))));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->assertTrue($locker->isFresh());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function testIsFreshFalseWithContentHash()
|
|
|
|
public function testIsFreshFalseWithContentHash()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$json = $this->createJsonFileMock();
|
|
|
|
$json = $this->createJsonFileMock();
|
|
|
|