function UpdatePathTestBase::prepareSettings

Same name in other branches
  1. 9 core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php \Drupal\FunctionalTests\Update\UpdatePathTestBase::prepareSettings()
  2. 8.9.x core/modules/system/src/Tests/Update/UpdatePathTestBase.php \Drupal\system\Tests\Update\UpdatePathTestBase::prepareSettings()
  3. 8.9.x core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php \Drupal\FunctionalTests\Update\UpdatePathTestBase::prepareSettings()
  4. 11.x core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php \Drupal\FunctionalTests\Update\UpdatePathTestBase::prepareSettings()

Add settings that are missed since the installer isn't run.

Overrides FunctionalTestSetupTrait::prepareSettings

2 calls to UpdatePathTestBase::prepareSettings()
Mysql8RequirePrimaryKeyUpdateTest::prepareSettings in core/modules/mysql/tests/src/Functional/Mysql8RequirePrimaryKeyUpdateTest.php
Add settings that are missed since the installer isn't run.
UpdatePathTestBase::installDrupal in core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php
Overrides BrowserTestBase::installDrupal() for update testing.
1 method overrides UpdatePathTestBase::prepareSettings()
Mysql8RequirePrimaryKeyUpdateTest::prepareSettings in core/modules/mysql/tests/src/Functional/Mysql8RequirePrimaryKeyUpdateTest.php
Add settings that are missed since the installer isn't run.

File

core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php, line 172

Class

UpdatePathTestBase
Provides a base class for writing an update test.

Namespace

Drupal\FunctionalTests\Update

Code

protected function prepareSettings() {
    parent::prepareSettings();
    // Generate a hash salt.
    $settings['settings']['hash_salt'] = (object) [
        'value' => Crypt::randomBytesBase64(55),
        'required' => TRUE,
    ];
    // Since the installer isn't run, add the database settings here too.
    $settings['databases']['default'] = (object) [
        'value' => Database::getConnectionInfo(),
        'required' => TRUE,
    ];
    // Force every update hook to only run one entity per batch.
    $settings['settings']['entity_update_batch_size'] = (object) [
        'value' => 1,
        'required' => TRUE,
    ];
    // Set up sync directory.
    $settings['settings']['config_sync_directory'] = (object) [
        'value' => $this->publicFilesDirectory . '/config_sync',
        'required' => TRUE,
    ];
    $this->writeSettings($settings);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.