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)
|
// 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(
|
$repos = array_merge(
|
||||||
$this->repositoryManager->getLocalRepositories(),
|
$this->repositoryManager->getLocalRepositories(),
|
||||||
array(
|
array(
|
||||||
new InstalledArrayRepository(array($this->package)),
|
new InstalledArrayRepository(array($installedRootPackage)),
|
||||||
new PlatformRepository(),
|
new PlatformRepository(),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -47,8 +47,8 @@ Aliases take precedence over default package
|
||||||
--RUN--
|
--RUN--
|
||||||
install
|
install
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
Installing a/b (dev-master forked)
|
|
||||||
Marking a/b (1.0.x-dev forked) as installed, alias of 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)
|
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/a (dev-master master)
|
||||||
Installing a/c (dev-feature-foo feat.f)
|
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
|
* @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) {
|
if ($condition) {
|
||||||
eval('$res = '.$condition.';');
|
eval('$res = '.$condition.';');
|
||||||
|
@ -141,7 +141,7 @@ class InstallerTest extends TestCase
|
||||||
$output .= $text . ($newline ? "\n":"");
|
$output .= $text . ($newline ? "\n":"");
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$composer = FactoryMock::create($io, $composer);
|
$composer = FactoryMock::create($io, $composerConfig);
|
||||||
|
|
||||||
$jsonMock = $this->getMockBuilder('Composer\Json\JsonFile')->disableOriginalConstructor()->getMock();
|
$jsonMock = $this->getMockBuilder('Composer\Json\JsonFile')->disableOriginalConstructor()->getMock();
|
||||||
$jsonMock->expects($this->any())
|
$jsonMock->expects($this->any())
|
||||||
|
@ -167,8 +167,11 @@ class InstallerTest extends TestCase
|
||||||
$lockJsonMock->expects($this->any())
|
$lockJsonMock->expects($this->any())
|
||||||
->method('read')
|
->method('read')
|
||||||
->will($this->returnValue($lock));
|
->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);
|
$composer->setLocker($locker);
|
||||||
|
|
||||||
$autoloadGenerator = $this->getMock('Composer\Autoload\AutoloadGenerator');
|
$autoloadGenerator = $this->getMock('Composer\Autoload\AutoloadGenerator');
|
||||||
|
@ -245,6 +248,9 @@ class InstallerTest extends TestCase
|
||||||
$composer = JsonFile::parseJson($match['composer']);
|
$composer = JsonFile::parseJson($match['composer']);
|
||||||
if (!empty($match['lock'])) {
|
if (!empty($match['lock'])) {
|
||||||
$lock = JsonFile::parseJson($match['lock']);
|
$lock = JsonFile::parseJson($match['lock']);
|
||||||
|
if (!isset($lock['hash'])) {
|
||||||
|
$lock['hash'] = md5(json_encode($composer));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!empty($match['installed'])) {
|
if (!empty($match['installed'])) {
|
||||||
$installed = JsonFile::parseJson($match['installed']);
|
$installed = JsonFile::parseJson($match['installed']);
|
||||||
|
|
Loading…
Reference in New Issue