public function LanguageCookieNegotiationConfigTest::testLanguageCookieNegotiationConfigForm in Language Cookie 8
Test the language_cookie negotiation config form.
File
- tests/
src/ Functional/ LanguageCookieNegotiationConfigTest.php, line 57
Class
- LanguageCookieNegotiationConfigTest
- Test the language cookie negotiation config.
Namespace
Drupal\Tests\language_cookie\FunctionalCode
public function testLanguageCookieNegotiationConfigForm() {
$this
->drupalGet('admin/config/regional/language/detection/language_cookie');
$this
->submitForm([
'param' => 'language_cookie',
'time' => 100000,
'path' => '/drupal',
'domain' => 'example.com',
'secure' => TRUE,
'http_only' => TRUE,
'set_on_every_pageload' => TRUE,
'blacklisted_paths' => '/admin/*' . PHP_EOL . '/user/*',
], 'Save configuration');
$config = $this
->config('language_cookie.negotiation');
$this
->assertEquals('language_cookie', $config
->get('param'));
$this
->assertEquals(100000, $config
->get('time'));
$this
->assertEquals('/drupal', $config
->get('path'));
$this
->assertEquals('example.com', $config
->get('domain'));
$this
->assertTrue($config
->get('secure'));
$this
->assertTrue($config
->get('http_only'));
$this
->assertTrue($config
->get('set_on_every_pageload'));
$this
->assertEquals([
'/admin/*',
'/user/*',
], $config
->get('blacklisted_paths'));
$this
->drupalGet('admin/config/regional/language/detection/language_cookie');
$this
->assertSession()
->fieldValueEquals('param', 'language_cookie');
$this
->assertSession()
->fieldValueEquals('time', 100000);
$this
->assertSession()
->fieldValueEquals('path', '/drupal');
$this
->assertSession()
->fieldValueEquals('domain', 'example.com');
$this
->assertSession()
->checkboxChecked('secure');
$this
->assertSession()
->checkboxChecked('http_only');
$this
->assertSession()
->checkboxChecked('set_on_every_pageload');
$this
->assertSession()
->fieldValueEquals('blacklisted_paths', '/admin/*' . PHP_EOL . '/user/*');
}