You are here

public function DomainHookTest::testHookDomainRequestAlter in Domain Access 8

Tests domain request alteration.

File

domain/tests/src/Kernel/DomainHookTest.php, line 120

Class

DomainHookTest
Tests domain hooks documented in domain.api.php.

Namespace

Drupal\Tests\domain\Kernel

Code

public function testHookDomainRequestAlter() {

  // Set the request.
  $negotiator = \Drupal::service('domain.negotiator');
  $negotiator
    ->setRequestDomain($this->baseHostname);

  // Check that the property was added by our hook.
  $domain = $negotiator
    ->getActiveDomain();
  $this
    ->assertTrue($domain->foo1 == 'bar1', 'The foo1 property was set to <em>bar1</em> by hook_domain_request_alter');
}