Fix tests
parent
99eb2252f4
commit
bf307de1d6
|
@ -19,7 +19,7 @@ Requirements from the composer file are not installed if the lock file is presen
|
||||||
--LOCK--
|
--LOCK--
|
||||||
{
|
{
|
||||||
"packages": [
|
"packages": [
|
||||||
{ "package": "required", "version": "1.0.0" }
|
{ "name": "required", "version": "1.0.0" }
|
||||||
],
|
],
|
||||||
"packages-dev": null,
|
"packages-dev": null,
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
|
|
|
@ -24,9 +24,9 @@ Limited update takes rules from lock if available, and not from the installed re
|
||||||
--LOCK--
|
--LOCK--
|
||||||
{
|
{
|
||||||
"packages": [
|
"packages": [
|
||||||
{ "package": "old/installed", "version": "1.0.0" },
|
{ "name": "old/installed", "version": "1.0.0" },
|
||||||
{ "package": "toupdate/installed", "version": "1.0.0" },
|
{ "name": "toupdate/installed", "version": "1.0.0" },
|
||||||
{ "package": "toupdate/notinstalled", "version": "1.0.0" }
|
{ "name": "toupdate/notinstalled", "version": "1.0.0" }
|
||||||
],
|
],
|
||||||
"packages-dev": null,
|
"packages-dev": null,
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
namespace Composer\Test\Package;
|
namespace Composer\Test\Package;
|
||||||
|
|
||||||
use Composer\Package\Locker;
|
use Composer\Package\Locker;
|
||||||
|
use Composer\Package\CompletePackage;
|
||||||
|
|
||||||
class LockerTest extends \PHPUnit_Framework_TestCase
|
class LockerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -68,57 +69,14 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
||||||
->method('read')
|
->method('read')
|
||||||
->will($this->returnValue(array(
|
->will($this->returnValue(array(
|
||||||
'packages' => array(
|
'packages' => array(
|
||||||
array('package' => 'pkg1', 'version' => '1.0.0-beta'),
|
array('name' => 'pkg1', 'version' => '1.0.0-beta'),
|
||||||
array('package' => 'pkg2', 'version' => '0.1.10')
|
array('name' => 'pkg2', 'version' => '0.1.10')
|
||||||
)
|
)
|
||||||
)));
|
)));
|
||||||
|
|
||||||
$package1 = $this->createPackageMock();
|
$repo = $locker->getLockedRepository();
|
||||||
$package2 = $this->createPackageMock();
|
$this->assertNotNull($repo->findPackage('pkg1', '1.0.0-beta'));
|
||||||
|
$this->assertNotNull($repo->findPackage('pkg2', '0.1.10'));
|
||||||
$repo->getLocalRepository()
|
|
||||||
->expects($this->exactly(2))
|
|
||||||
->method('findPackage')
|
|
||||||
->with($this->logicalOr('pkg1', 'pkg2'), $this->logicalOr('1.0.0-beta', '0.1.10'))
|
|
||||||
->will($this->onConsecutiveCalls($package1, $package2));
|
|
||||||
|
|
||||||
$this->assertEquals(array($package1, $package2), $locker->getLockedRepository()->getPackages());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testGetPackagesWithoutRepo()
|
|
||||||
{
|
|
||||||
$json = $this->createJsonFileMock();
|
|
||||||
$repo = $this->createRepositoryManagerMock();
|
|
||||||
$inst = $this->createInstallationManagerMock();
|
|
||||||
|
|
||||||
$locker = new Locker($json, $repo, $inst, 'md5');
|
|
||||||
|
|
||||||
$json
|
|
||||||
->expects($this->once())
|
|
||||||
->method('exists')
|
|
||||||
->will($this->returnValue(true));
|
|
||||||
$json
|
|
||||||
->expects($this->once())
|
|
||||||
->method('read')
|
|
||||||
->will($this->returnValue(array(
|
|
||||||
'packages' => array(
|
|
||||||
array('package' => 'pkg1', 'version' => '1.0.0-beta'),
|
|
||||||
array('package' => 'pkg2', 'version' => '0.1.10')
|
|
||||||
)
|
|
||||||
)));
|
|
||||||
|
|
||||||
$package1 = $this->createPackageMock();
|
|
||||||
$package2 = $this->createPackageMock();
|
|
||||||
|
|
||||||
$repo->getLocalRepository()
|
|
||||||
->expects($this->exactly(2))
|
|
||||||
->method('findPackage')
|
|
||||||
->with($this->logicalOr('pkg1', 'pkg2'), $this->logicalOr('1.0.0-beta', '0.1.10'))
|
|
||||||
->will($this->onConsecutiveCalls($package1, null));
|
|
||||||
|
|
||||||
$this->setExpectedException('LogicException');
|
|
||||||
|
|
||||||
$locker->getLockedRepository();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetLockData()
|
public function testSetLockData()
|
||||||
|
|
Loading…
Reference in New Issue