Root requires are not taken into account in locked installs, fixes #669
parent
d56c996622
commit
5bfbff867c
|
@ -141,10 +141,14 @@ class Installer
|
|||
}
|
||||
|
||||
// create installed repo, this contains all local packages + platform packages (php & extensions)
|
||||
$installedRootPackage = clone $this->package;
|
||||
$installedRootPackage->setRequires(array());
|
||||
$installedRootPackage->setDevRequires(array());
|
||||
|
||||
$repos = array_merge(
|
||||
$this->repositoryManager->getLocalRepositories(),
|
||||
array(
|
||||
new InstalledArrayRepository(array($this->package)),
|
||||
new InstalledArrayRepository(array($installedRootPackage)),
|
||||
new PlatformRepository(),
|
||||
)
|
||||
);
|
||||
|
|
|
@ -47,8 +47,8 @@ Aliases take precedence over default package
|
|||
--RUN--
|
||||
install
|
||||
--EXPECT--
|
||||
Installing a/b (dev-master forked)
|
||||
Marking a/b (1.0.x-dev forked) as installed, alias of a/b (dev-master forked)
|
||||
Installing a/b (dev-master forked)
|
||||
Marking a/c (dev-master feat.f) as installed, alias of a/c (dev-feature-foo feat.f)
|
||||
Installing a/a (dev-master master)
|
||||
Installing a/c (dev-feature-foo feat.f)
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
--TEST--
|
||||
Requirements from the composer file are not installed if the lock file is present
|
||||
--COMPOSER--
|
||||
{
|
||||
"repositories": [
|
||||
{
|
||||
"type": "package",
|
||||
"package": [
|
||||
{ "name": "required", "version": "1.0.0" },
|
||||
{ "name": "newly-required", "version": "1.0.0" }
|
||||
]
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"required": "1.0.0",
|
||||
"newly-required": "1.0.0"
|
||||
}
|
||||
}
|
||||
--LOCK--
|
||||
{
|
||||
"packages": [
|
||||
{ "package": "required", "version": "1.0.0" }
|
||||
],
|
||||
"packages-dev": null,
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": []
|
||||
}
|
||||
--RUN--
|
||||
install
|
||||
--EXPECT--
|
||||
Installing required (1.0.0)
|
|
@ -124,7 +124,7 @@ class InstallerTest extends TestCase
|
|||
/**
|
||||
* @dataProvider getIntegrationTests
|
||||
*/
|
||||
public function testIntegration($file, $message, $condition, $composer, $lock, $installed, $installedDev, $run, $expect)
|
||||
public function testIntegration($file, $message, $condition, $composerConfig, $lock, $installed, $installedDev, $run, $expect)
|
||||
{
|
||||
if ($condition) {
|
||||
eval('$res = '.$condition.';');
|
||||
|
@ -141,7 +141,7 @@ class InstallerTest extends TestCase
|
|||
$output .= $text . ($newline ? "\n":"");
|
||||
}));
|
||||
|
||||
$composer = FactoryMock::create($io, $composer);
|
||||
$composer = FactoryMock::create($io, $composerConfig);
|
||||
|
||||
$jsonMock = $this->getMockBuilder('Composer\Json\JsonFile')->disableOriginalConstructor()->getMock();
|
||||
$jsonMock->expects($this->any())
|
||||
|
@ -167,8 +167,11 @@ class InstallerTest extends TestCase
|
|||
$lockJsonMock->expects($this->any())
|
||||
->method('read')
|
||||
->will($this->returnValue($lock));
|
||||
$lockJsonMock->expects($this->any())
|
||||
->method('exists')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$locker = new Locker($lockJsonMock, $repositoryManager, isset($lock['hash']) ? $lock['hash'] : '');
|
||||
$locker = new Locker($lockJsonMock, $repositoryManager, md5(json_encode($composerConfig)));
|
||||
$composer->setLocker($locker);
|
||||
|
||||
$autoloadGenerator = $this->getMock('Composer\Autoload\AutoloadGenerator');
|
||||
|
@ -245,6 +248,9 @@ class InstallerTest extends TestCase
|
|||
$composer = JsonFile::parseJson($match['composer']);
|
||||
if (!empty($match['lock'])) {
|
||||
$lock = JsonFile::parseJson($match['lock']);
|
||||
if (!isset($lock['hash'])) {
|
||||
$lock['hash'] = md5(json_encode($composer));
|
||||
}
|
||||
}
|
||||
if (!empty($match['installed'])) {
|
||||
$installed = JsonFile::parseJson($match['installed']);
|
||||
|
|
Loading…
Reference in New Issue