public function LanguageCookieNegotiationConfigTest::testLanguageCookieTimeOption in Language Cookie 8
Test the language_cookie time config option.
File
- tests/
src/ Functional/ LanguageCookieNegotiationConfigTest.php, line 113
Class
- LanguageCookieNegotiationConfigTest
- Test the language cookie negotiation config.
Namespace
Drupal\Tests\language_cookie\FunctionalCode
public function testLanguageCookieTimeOption() {
$config = $this
->config('language_cookie.negotiation');
$config
->set('time', 60 * 60 * 24);
$config
->save();
$node = $this
->drupalCreateNode();
$this
->drupalGet('fr/node/' . $node
->id());
$this
->assertRegExp('/max-age=86/i', $this
->drupalGetHeader('Set-Cookie'), 'Cookie contains expires option.');
$config
->set('time', 60 * 60 * 24 * 2);
$config
->save();
$node = $this
->drupalCreateNode();
$this
->drupalGet('en/node/' . $node
->id());
$this
->assertRegExp('/max-age=172/i', $this
->drupalGetHeader('Set-Cookie'), 'Cookie contains expires option.');
}