You are here

public function DomainHookTest::testHookDomainLoad in Domain Access 8

Tests domain loading.

File

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

Class

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

Namespace

Drupal\Tests\domain\Kernel

Code

public function testHookDomainLoad() {

  // Check the created domain based on its known id value.
  $domain = $this->domainStorage
    ->load($this->key);

  // Internal hooks.
  $path = $domain
    ->getPath();
  $url = $domain
    ->getUrl();
  $this
    ->assertTrue(isset($path), new FormattableMarkup('The path property was set to %path by hook_entity_load.', [
    '%path' => $path,
  ]));
  $this
    ->assertTrue(isset($url), new FormattableMarkup('The url property was set to %url by hook_entity_load.', [
    '%url' => $url,
  ]));

  // External hooks.
  $this
    ->assertTrue($domain->foo == 'bar', 'The foo property was set to <em>bar</em> by hook_domain_load.');
}