You are here

public function DomainConfigAlterHookTest::testHookDomainRequestAlter in Domain Access 8

Tests domain request alteration.

File

domain_config/tests/src/Functional/DomainConfigAlterHookTest.php, line 62

Class

DomainConfigAlterHookTest
Tests for https://www.drupal.org/node/2896434#comment-12265088.

Namespace

Drupal\Tests\domain_config\Functional

Code

public function testHookDomainRequestAlter() {

  // Check for the count of hook implementations.
  $hooks = $this->moduleHandler
    ->getImplementations('domain_request_alter');
  $this
    ->assertCount(1, $hooks, 'One hook implementation found.');

  // Assert that the hook is also called on a request with a HTTP Middleware
  // that requests config thus triggering an early hook invocation (before
  // modules are loaded by the kernel).
  $this
    ->drupalGet('<front>');
  $this
    ->assertEquals('invoked', $this
    ->drupalGetHeader('X-Domain-Config-Test-page-attachments-hook'));
}