You are here

public function ToolbarLanguageSwitcherTest::testTwoLanguagesProjectSetup 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::testTwoLanguagesProjectSetup()
  2. 2.0.x tests/src/Functional/ToolbarLanguageSwitcherTest.php \Drupal\Tests\toolbar_language_switcher\Functional\ToolbarLanguageSwitcherTest::testTwoLanguagesProjectSetup()

Test two languages project setup.

File

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

Class

ToolbarLanguageSwitcherTest
Base test class for toolbar_language_switcher tests.

Namespace

Drupal\Tests\toolbar_language_switcher\Functional

Code

public function testTwoLanguagesProjectSetup() {
  $languages = [
    'xx' => 'Lolspeak1',
  ];
  $this
    ->installLanguages($languages);
  $front_page = Url::fromRoute('<front>');
  $assert_session = $this
    ->assertSession();
  $this
    ->drupalLogin($this->user);
  $this
    ->drupalGet($front_page);
  $assert_session
    ->linkExists('Switch to Lolspeak1');
  $this
    ->clickLink('Switch to Lolspeak1');
  $assert_session
    ->linkExists('Switch to English');
  $this
    ->clickLink('Switch to English');
  $assert_session
    ->linkExists('Switch to Lolspeak1');
}