diff --git a/tests/Composer/Test/Package/LockerTest.php b/tests/Composer/Test/Package/LockerTest.php index 79f82e74d..65dcbb62b 100644 --- a/tests/Composer/Test/Package/LockerTest.php +++ b/tests/Composer/Test/Package/LockerTest.php @@ -118,7 +118,6 @@ class LockerTest extends \PHPUnit_Framework_TestCase ->method('getVersion') ->will($this->returnValue('0.1.10.0')); - $hash = md5($jsonContent); $contentHash = md5(trim($jsonContent)); $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', 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file', 'This file is @gener'.'ated automatically', ), - 'hash' => $hash, 'content-hash' => $contentHash, 'packages' => array( array('name' => 'pkg1', 'version' => '1.0.0-beta'), @@ -217,6 +215,23 @@ class LockerTest extends \PHPUnit_Framework_TestCase $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() { $json = $this->createJsonFileMock();