You are here

trait AcquiaContentHubAdminSettingsTrait in Acquia Content Hub 8.2

Trait for ACH admin settings configurations.

Hierarchy

2 files declare their use of AcquiaContentHubAdminSettingsTrait
ClientFactoryTest.php in tests/src/Kernel/ClientFactoryTest.php
ImportUpdateAssetsTest.php in tests/src/Kernel/ImportUpdateAssetsTest.php

File

tests/src/Kernel/Traits/AcquiaContentHubAdminSettingsTrait.php, line 8

Namespace

Drupal\Tests\acquia_contenthub\Kernel\Traits
View source
trait AcquiaContentHubAdminSettingsTrait {

  /**
   * Get Acquia Content Hub settings.
   *
   * @param array $settings
   *   Content Hub settings.
   */
  protected function createAcquiaContentHubAdminSettings(array $settings = []) : void {
    $default_settings = [
      'client_name' => 'test-client',
      'origin' => '00000000-0000-0001-0000-123456789123',
      'api_key' => '12312321312321',
      'secret_key' => '12312321312321',
      'hostname' => 'https://dev.content-hub.dev',
      'shared_secret' => '12312321312321',
      'event_service_url' => 'http://example.com',
    ];
    $actual_settings = array_merge($default_settings, $settings);
    $admin_settings = \Drupal::configFactory()
      ->getEditable('acquia_contenthub.admin_settings');
    $admin_settings
      ->setData($actual_settings)
      ->save();
  }

}

Members