You are here

public function DomainMenuAccessInstallTest::testDomainAccessFields in Domain Menu Access 8

Test module install with domain access fields.

File

tests/src/Functional/DomainMenuAccessInstallTest.php, line 54

Class

DomainMenuAccessInstallTest
Test installation of domain_menu_access module.

Namespace

Drupal\Tests\domain_menu_access\Functional

Code

public function testDomainAccessFields() {
  $main_menu_id = 'main';
  $this->configFactory
    ->getEditable('domain_menu_access.settings')
    ->set('menu_enabled', [
    $main_menu_id,
  ])
    ->save();
  $this
    ->drupalLogin($this->rootUser);
  $add_link = Url::fromRoute('entity.menu.add_link_form', [
    'menu' => $main_menu_id,
  ]);
  $this
    ->drupalGet($add_link);
  $domains = $this->domainStorage
    ->loadMultiple();
  foreach ($domains as $domain) {
    $access_field = DOMAIN_ACCESS_FIELD . '[' . $domain
      ->id() . ']';
    $this
      ->assertSession()
      ->fieldExists($access_field);
  }
  $access_all_field = DOMAIN_ACCESS_ALL_FIELD . '[value]';
  $this
    ->assertSession()
    ->fieldExists($access_all_field);
}