LanguageAccessPermissionsTest.php in Language access 8
File
tests/src/Kernel/LanguageAccessPermissionsTest.php
View source
<?php
namespace Drupal\Tests\language_access\Kernel;
use Drupal\KernelTests\KernelTestBase;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\language_access\LanguageAccessPermissions;
class LanguageAccessPermissionsTest extends KernelTestBase {
protected static $modules = [
'language_access',
'language',
'system',
];
protected $languageAccessPermissions;
protected function setUp() : void {
parent::setUp();
$this->languageAccessPermissions = LanguageAccessPermissions::create($this->container);
}
public function testPermissions() {
$this
->assertEquals([
'access language en',
], array_keys($this->languageAccessPermissions
->permissions()));
ConfigurableLanguage::createFromLangcode('nl')
->save();
$this
->assertEquals([
'access language nl',
'access language en',
], array_keys($this->languageAccessPermissions
->permissions()));
ConfigurableLanguage::load('nl')
->delete();
$this
->assertEquals([
'access language en',
], array_keys($this->languageAccessPermissions
->permissions()));
}
}