1
0
Fork 0

Make sure a lock file is always written and things work well even without any dependencies in the require/require-dev

pull/8561/head
Jordi Boggiano 2020-01-28 15:14:58 +01:00
parent 173b96de2d
commit 292d4b3c8f
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
3 changed files with 67 additions and 12 deletions

View File

@ -345,18 +345,6 @@ class Locker
$lock['platform-overrides'] = $platformOverrides;
}
if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
if ($this->lockFile->exists()) {
if ($write) {
unlink($this->lockFile->getPath());
} else {
$this->virtualFileWritten = false;
}
}
return false;
}
try {
$isLocked = $this->isLocked();
} catch (ParsingException $e) {

View File

@ -0,0 +1,20 @@
--TEST--
Update to a state without dependency works well from a blank slate
--COMPOSER--
{
}
--RUN--
update
--EXPECT-LOCK--
{
"packages": [],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}
--EXPECT--

View File

@ -0,0 +1,47 @@
--TEST--
Update to a state without dependency works well from locked with dependency
--COMPOSER--
{
"minimum-stability": "dev"
}
--INSTALLED--
[
{
"name": "a/a", "version": "dev-master",
"source": { "reference": "1234", "type": "git", "url": "" }
}
]
--LOCK--
{
"packages": [
{
"name": "a/a", "version": "dev-master",
"source": { "reference": "1234", "type": "git", "url": "" },
"type": "library"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}
--RUN--
update
--EXPECT-LOCK--
{
"packages": [],
"packages-dev": [],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}
--EXPECT--
Uninstalling a/a (dev-master 1234)