You are here

public function ToolbarLanguageSwitcherTest::testNotRenderedForTheForbiddenUser in Admin Toolbar Language Switcher 8

Same name and namespace in other branches
  1. 8.1.x tests/src/Functional/ToolbarLanguageSwitcherTest.php \Drupal\Tests\toolbar_language_switcher\Functional\ToolbarLanguageSwitcherTest::testNotRenderedForTheForbiddenUser()
  2. 2.0.x tests/src/Functional/ToolbarLanguageSwitcherTest.php \Drupal\Tests\toolbar_language_switcher\Functional\ToolbarLanguageSwitcherTest::testNotRenderedForTheForbiddenUser()

Test use use toolbar_language_switcher permission.

File

tests/src/Functional/ToolbarLanguageSwitcherTest.php, line 106

Class

ToolbarLanguageSwitcherTest
Base test class for toolbar_language_switcher tests.

Namespace

Drupal\Tests\toolbar_language_switcher\Functional

Code

public function testNotRenderedForTheForbiddenUser() {
  $languages = [
    'xx' => 'Lolspeak1',
    'zz' => 'Lolspeak2',
  ];
  $this
    ->installLanguages($languages);
  $front_page = Url::fromRoute('<front>');
  $assert_session = $this
    ->assertSession();

  // Check permission access. Create user without required permissions.
  $this
    ->drupalLogin($this
    ->drupalCreateUser([
    'access toolbar',
  ]));
  $this
    ->drupalGet($front_page);
  foreach ($languages as $title) {
    $assert_session
      ->linkNotExists($title);
  }
}