LanguageCookieLanguageAccessTest.php in Language Cookie 8
File
tests/src/Functional/LanguageCookieLanguageAccessTest.php
View source
<?php
namespace Drupal\Tests\language_cookie\Functional;
class LanguageCookieLanguageAccessTest extends LanguageCookieTestBase {
protected static $modules = [
'language_access',
];
public function testLanguageAccess() {
$node = $this
->drupalCreateNode();
$user = $this
->createUser([
'access language en',
]);
$this
->drupalLogin($user);
$this
->getSession()
->setCookie('language');
$this
->drupalGet('fr/node/' . $node
->id());
$this
->assertEmpty($this
->getSession()
->getCookie('language'));
$this
->drupalGet('en/node/' . $node
->id());
$this
->assertSession()
->cookieEquals('language', 'en');
$user = $this
->createUser([
'access language fr',
'access language en',
]);
$this
->drupalLogin($user);
$this
->getSession()
->setCookie('language');
$this
->drupalGet('fr/node/' . $node
->id());
$this
->assertSession()
->cookieEquals('language', 'fr');
}
}