protected function LanguageAccessAdminTest::setUp in Language access 8
Overrides LanguageAccessTestBase::setUp
File
- tests/
src/ Functional/ LanguageAccessAdminTest.php, line 28
Class
- LanguageAccessAdminTest
- Test language access on entity admin screens.
Namespace
Drupal\Tests\language_access\FunctionalCode
protected function setUp() : void {
parent::setUp();
$this->entityTypeManager = $this->container
->get('entity_type.manager');
// Create a taxonomy vocabulary and make it translatable.
$this->entityTypeManager
->getStorage('taxonomy_vocabulary')
->create([
'vid' => 'tags',
'name' => 'Tags',
])
->save();
$config = ContentLanguageSettings::loadByEntityTypeBundle('taxonomy_term', 'tags');
$config
->setDefaultLangcode('en')
->setLanguageAlterable(TRUE)
->save();
// Create a content block type and make it translatable.
$this->entityTypeManager
->getStorage('block_content_type')
->create([
'id' => 'basic',
'label' => 'Basic',
])
->save();
$config = ContentLanguageSettings::loadByEntityTypeBundle('block_content', 'basic');
$config
->setDefaultLangcode('en')
->setLanguageAlterable(TRUE)
->save();
$role_id = $this
->drupalCreateRole([
'administer blocks',
'create page content',
'create terms in tags',
'administer users',
]);
$this->userEn
->addRole($role_id);
$this->userEn
->save();
$this->userNl
->addRole($role_id);
$this->userNl
->save();
}