You are here

protected function LocalPackagesTrait::alterPackage in Automatic Updates 8.2

Alters a package's composer.json file.

Parameters

string $package_dir: The package directory.

array $changes: The changes to merge into composer.json.

3 calls to LocalPackagesTrait::alterPackage()
CoreUpdateTest::createTestSite in tests/src/Build/CoreUpdateTest.php
Uses our already-installed dependencies to build a test site to update.
CoreUpdateTest::getConfigurationForUpdate in tests/src/Build/CoreUpdateTest.php
Returns composer.json changes that are needed to update core.
CoreUpdateTest::setCoreVersion in tests/src/Build/CoreUpdateTest.php
Modifies a Drupal core code base to set its version.

File

tests/src/Traits/LocalPackagesTrait.php, line 142

Class

LocalPackagesTrait
Provides methods for interacting with installed Composer packages.

Namespace

Drupal\Tests\automatic_updates\Traits

Code

protected function alterPackage(string $package_dir, array $changes) : void {
  $composer = $package_dir . DIRECTORY_SEPARATOR . 'composer.json';
  $data = $this
    ->readJson($composer);
  $data = NestedArray::mergeDeep($data, $changes);
  $this
    ->writeJson($composer, $data);
}