You are here

public function GetSettingsFromEnvVarTest::testGetSettingsFromEnvVar in Acquia Content Hub 8.2

Tests GetSettingsFromEnvVar event subscriber.

@dataProvider credentialsDataProvider

Parameters

array $credentials: Credentials for registering with ACH.

string $settings_provider: Expected settings provider.

array $expected_settings: Expected setting values.

Throws

\Exception

File

tests/src/Kernel/EventSubscriber/GetSettings/GetSettingsFromEnvVarTest.php, line 62

Class

GetSettingsFromEnvVarTest
Tests that environment variables can be used for settings.

Namespace

Drupal\Tests\acquia_contenthub\Kernel\EventSubscriber\GetSettings

Code

public function testGetSettingsFromEnvVar(array $credentials, string $settings_provider, array $expected_settings) {
  foreach ($credentials as $key => $value) {
    putenv("{$key}={$value}");
  }
  $event = new AcquiaContentHubSettingsEvent();
  $this->dispatcher
    ->dispatch(AcquiaContentHubEvents::GET_SETTINGS, $event);
  $this
    ->assertEqual($event
    ->getSettings()
    ->toArray(), $expected_settings);
  $this
    ->assertEqual($event
    ->getProvider(), $settings_provider);
}