You are here

protected function ThunderTestTrait::prepareSettings in Thunder 6.0.x

Same name and namespace in other branches
  1. 8.5 tests/src/Traits/ThunderTestTrait.php \Drupal\Tests\thunder\Traits\ThunderTestTrait::prepareSettings()
  2. 8.2 tests/src/Traits/ThunderTestTrait.php \Drupal\Tests\thunder\Traits\ThunderTestTrait::prepareSettings()
  3. 8.3 tests/src/Traits/ThunderTestTrait.php \Drupal\Tests\thunder\Traits\ThunderTestTrait::prepareSettings()
  4. 8.4 tests/src/Traits/ThunderTestTrait.php \Drupal\Tests\thunder\Traits\ThunderTestTrait::prepareSettings()
  5. 6.2.x tests/src/Traits/ThunderTestTrait.php \Drupal\Tests\thunder\Traits\ThunderTestTrait::prepareSettings()
  6. 6.1.x tests/src/Traits/ThunderTestTrait.php \Drupal\Tests\thunder\Traits\ThunderTestTrait::prepareSettings()
1 call to ThunderTestTrait::prepareSettings()
ThunderTestTrait::installDrupal in tests/src/Traits/ThunderTestTrait.php

File

tests/src/Traits/ThunderTestTrait.php, line 72

Class

ThunderTestTrait
Use this trait to reuse an existing database.

Namespace

Drupal\Tests\thunder\Traits

Code

protected function prepareSettings() {
  parent::prepareSettings();

  // Remember the profile which was used.
  $settings['settings']['install_profile'] = (object) [
    'value' => $this->profile,
    'required' => TRUE,
  ];

  // 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['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);
}