You are here

public function LanguageCookieConditionTest::testOneLanguage in Language Cookie 8

Test that language_cookie also works with only 1 language.

File

tests/src/Functional/LanguageCookieConditionTest.php, line 113

Class

LanguageCookieConditionTest
Tests that the condition plugins work.

Namespace

Drupal\Tests\language_cookie\Functional

Code

public function testOneLanguage() {

  // Remove the second language.
  $language = ConfigurableLanguage::load('fr');
  $language
    ->delete();
  $node = $this
    ->drupalCreateNode();

  // Check that the cookie is correctly set.
  $this
    ->getSession()
    ->setCookie('language', NULL);
  $this
    ->drupalGet('en/node/' . $node
    ->id());
  $this
    ->assertEmpty($this
    ->getSession()
    ->getCookie('language'));

  // Make sure that clearing the caches works with 1 language.
  $this
    ->drupalGet('admin/config/development/performance');
  $this
    ->submitForm([], 'Clear all caches');
}