1
0
Fork 0

Add tests for installer with lock: false

https://github.com/composer/composer/issues/8354
pull/8384/head
Arnout Boks 2019-10-20 10:51:59 +02:00
parent 7c5e5e3ede
commit 22caa0f097
3 changed files with 58 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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,8 +322,12 @@ class InstallerTest extends TestCase
}
$run = $testData['RUN'];
if (!empty($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'];
if (!empty($testData['EXPECT-EXCEPTION'])) {