Add tests for installer with lock: false

https://github.com/composer/composer/issues/8354
main
Arnout Boks 5 years ago
parent 7c5e5e3ede
commit 22caa0f097

@ -0,0 +1,25 @@
--TEST--
Installs from composer.json without writing a lock file
--COMPOSER--
{
"repositories": [
{
"type": "package",
"package": [
{ "name": "a/a", "version": "1.0.0" }
]
}
],
"require": {
"a/a": "1.0.0"
},
"config": {
"lock": "false"
}
}
--RUN--
install
--EXPECT--
Installing a/a (1.0.0)
--EXPECT-LOCK--
false

@ -0,0 +1,25 @@
--TEST--
Updates when no lock file is present without writing a lock file
--COMPOSER--
{
"repositories": [
{
"type": "package",
"package": [
{ "name": "a/a", "version": "1.0.0" }
]
}
],
"require": {
"a/a": "1.0.0"
},
"config": {
"lock": false
}
}
--RUN--
update
--EXPECT--
Installing a/a (1.0.0)
--EXPECT-LOCK--
false

@ -197,6 +197,9 @@ class InstallerTest extends TestCase
// so store value temporarily in reference for later assetion
$actualLock = $hash;
}));
} elseif ($expectLock === false) {
$lockJsonMock->expects($this->never())
->method('write');
}
$contents = json_encode($composerConfig);
@ -319,7 +322,11 @@ class InstallerTest extends TestCase
}
$run = $testData['RUN'];
if (!empty($testData['EXPECT-LOCK'])) {
$expectLock = JsonFile::parseJson($testData['EXPECT-LOCK']);
if ($testData['EXPECT-LOCK'] === 'false') {
$expectLock = false;
} else {
$expectLock = JsonFile::parseJson($testData['EXPECT-LOCK']);
}
}
$expectOutput = isset($testData['EXPECT-OUTPUT']) ? $testData['EXPECT-OUTPUT'] : null;
$expect = $testData['EXPECT'];

Loading…
Cancel
Save