1
0
Fork 0

Add plugin-api-version used to generate a lock file in itself

pull/8661/head
Jordi Boggiano 2020-02-28 10:21:24 +01:00
parent c4f19e51d8
commit 0b9c658bef
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
3 changed files with 5 additions and 0 deletions

View File

@ -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()) {

View File

@ -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);
}

View File

@ -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'));