protected function UpdateTestBase::getInitialConfiguration in Automatic Updates 8.2
Returns the initial data to write to the test site's composer.json.
This configuration will be used to build the pre-update test site.
Parameters
array $data: The current contents of the test site's composer.json.
Return value
array The data that should be written to the test site's composer.json.
1 call to UpdateTestBase::getInitialConfiguration()
- UpdateTestBase::createTestSite in tests/
src/ Build/ UpdateTestBase.php - Uses our already-installed dependencies to build a test site to update.
File
- tests/
src/ Build/ UpdateTestBase.php, line 201
Class
- UpdateTestBase
- Base class for tests that perform in-place updates.
Namespace
Drupal\Tests\automatic_updates\BuildCode
protected function getInitialConfiguration(array $data) : array {
$drupal_root = $this
->getDrupalRoot();
$core_composer_dir = $drupal_root . DIRECTORY_SEPARATOR . 'composer';
$repositories = [];
// Add all the metapackages that are provided by Drupal core.
$metapackage_dir = $core_composer_dir . DIRECTORY_SEPARATOR . 'Metapackage';
$repositories['drupal/core-recommended'] = $this
->createPathRepository($metapackage_dir . DIRECTORY_SEPARATOR . 'CoreRecommended');
$repositories['drupal/core-dev'] = $this
->createPathRepository($metapackage_dir . DIRECTORY_SEPARATOR . 'DevDependencies');
// Add all the Composer plugins that are provided by Drupal core.
$plugin_dir = $core_composer_dir . DIRECTORY_SEPARATOR . 'Plugin';
$repositories['drupal/core-project-message'] = $this
->createPathRepository($plugin_dir . DIRECTORY_SEPARATOR . 'ProjectMessage');
$repositories['drupal/core-composer-scaffold'] = $this
->createPathRepository($plugin_dir . DIRECTORY_SEPARATOR . 'Scaffold');
$repositories['drupal/core-vendor-hardening'] = $this
->createPathRepository($plugin_dir . DIRECTORY_SEPARATOR . 'VendorHardening');
$repositories = array_merge($repositories, $this
->getLocalPackageRepositories($drupal_root));
// To ensure the test runs entirely offline, don't allow Composer to contact
// Packagist.
$repositories['packagist.org'] = FALSE;
$repositories['drupal/automatic_updates'] = [
'type' => 'path',
'url' => __DIR__ . '/../../..',
];
// Use whatever the current branch of automatic_updates is.
$data['require']['drupal/automatic_updates'] = '*';
$data['repositories'] = $repositories;
// Since Drupal 9 requires PHP 7.3 or later, these packages are probably
// not installed, which can cause trouble during dependency resolution.
// The drupal/drupal package (defined with a composer.json that is part
// of core's repository) replaces these, so we need to emulate that here.
$data['replace']['symfony/polyfill-php72'] = '*';
$data['replace']['symfony/polyfill-php73'] = '*';
return $data;
}