From 0b9c658bef426a56dc3971e614028ff5078bcd95 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 28 Feb 2020 10:21:24 +0100 Subject: [PATCH] Add plugin-api-version used to generate a lock file in itself --- src/Composer/Package/Locker.php | 2 ++ tests/Composer/Test/InstallerTest.php | 1 + tests/Composer/Test/Package/LockerTest.php | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php index 57ec74233..8a500d837 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -19,6 +19,7 @@ use Composer\Util\ProcessExecutor; use Composer\Repository\ArrayRepository; use Composer\Package\Dumper\ArrayDumper; use Composer\Package\Loader\ArrayLoader; +use Composer\Plugin\PluginInterface; use Composer\Util\Git as GitUtil; use Composer\IO\IOInterface; use Seld\JsonLint\ParsingException; @@ -322,6 +323,7 @@ class Locker if ($platformOverrides) { $lock['platform-overrides'] = $platformOverrides; } + $lock['plugin-api-version'] = PluginInterface::PLUGIN_API_VERSION; if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) { if ($this->lockFile->exists()) { diff --git a/tests/Composer/Test/InstallerTest.php b/tests/Composer/Test/InstallerTest.php index 6a3d164c5..067baf17a 100644 --- a/tests/Composer/Test/InstallerTest.php +++ b/tests/Composer/Test/InstallerTest.php @@ -262,6 +262,7 @@ class InstallerTest extends TestCase unset($actualLock['hash']); unset($actualLock['content-hash']); unset($actualLock['_readme']); + unset($actualLock['plugin-api-version']); $this->assertEquals($expectLock, $actualLock); } diff --git a/tests/Composer/Test/Package/LockerTest.php b/tests/Composer/Test/Package/LockerTest.php index 3b887d06d..04e8e6c84 100644 --- a/tests/Composer/Test/Package/LockerTest.php +++ b/tests/Composer/Test/Package/LockerTest.php @@ -13,6 +13,7 @@ namespace Composer\Test\Package; use Composer\Package\Locker; +use Composer\Plugin\PluginInterface; use Composer\IO\NullIO; use Composer\Test\TestCase; @@ -154,6 +155,7 @@ class LockerTest extends TestCase 'platform-overrides' => array('foo/bar' => '1.0'), 'prefer-stable' => false, 'prefer-lowest' => false, + 'plugin-api-version' => PluginInterface::PLUGIN_API_VERSION, )); $locker->setLockData(array($package1, $package2), array(), array(), array(), array(), 'dev', array(), false, false, array('foo/bar' => '1.0'));