You are here

public function DomainConfigOverriderTest::testDomainConfigOverriderFromSettings in Domain Access 8

Tests that domain-specific variable overrides in settings.php works.

File

domain_config/tests/src/Functional/DomainConfigOverriderTest.php, line 51

Class

DomainConfigOverriderTest
Tests the domain config system.

Namespace

Drupal\Tests\domain_config\Functional

Code

public function testDomainConfigOverriderFromSettings() {

  // Set up overrides.
  $settings = [];
  $settings['config']['domain.config.one_example_com.en.system.site']['name'] = (object) [
    'value' => 'First',
    'required' => TRUE,
  ];
  $settings['config']['domain.config.four_example_com.system.site']['name'] = (object) [
    'value' => 'Four overridden in settings',
    'required' => TRUE,
  ];
  $this
    ->writeSettings($settings);

  // Create five new domains programmatically.
  $this
    ->domainCreateTestDomains(5);
  $domains = \Drupal::entityTypeManager()
    ->getStorage('domain')
    ->loadMultiple([
    'one_example_com',
    'four_example_com',
  ]);
  $domain_one = $domains['one_example_com'];
  $this
    ->drupalGet($domain_one
    ->getPath() . 'user/login');
  $this
    ->assertRaw('<title>Log in | First</title>', 'Found overridden slogan for one.example.com.');
  $domain_four = $domains['four_example_com'];
  $this
    ->drupalGet($domain_four
    ->getPath() . 'user/login');
  $this
    ->assertRaw('<title>Log in | Four overridden in settings</title>', 'Found overridden slogan for four.example.com.');
}