You are here

public function LanguageCookieNegotiationConfigTest::testLanguageCookieParamOption in Language Cookie 8

Test the language_cookie param config option.

File

tests/src/Functional/LanguageCookieNegotiationConfigTest.php, line 97

Class

LanguageCookieNegotiationConfigTest
Test the language cookie negotiation config.

Namespace

Drupal\Tests\language_cookie\Functional

Code

public function testLanguageCookieParamOption() {
  $this
    ->getSession()
    ->setCookie('language', NULL);
  $config = $this
    ->config('language_cookie.negotiation');
  $config
    ->set('param', 'language_cookie');
  $config
    ->save();
  $node = $this
    ->drupalCreateNode();
  $this
    ->drupalGet('fr/node/' . $node
    ->id());
  $this
    ->assertEmpty($this
    ->getSession()
    ->getCookie('language'));
  $this
    ->assertSession()
    ->cookieEquals('language_cookie', 'fr');
}