public function MultilingualTest::testCanAccess in Permissions by Term 8.2
Same name and namespace in other branches
- 8 tests/src/Kernel/MultilingualTest.php \Drupal\Tests\permissions_by_term\Kernel\MultilingualTest::testCanAccess()
File
- tests/
src/ Kernel/ MultilingualTest.php, line 34
Class
- MultilingualTest
- @group permissions_by_term
Namespace
Drupal\Tests\permissions_by_term\KernelCode
public function testCanAccess() {
Vocabulary::create([
'name' => 'Test Multilingual',
'vid' => 'test_multilingual',
'langcode' => 'de',
])
->save();
$term = Term::create([
'name' => 'term1',
'vid' => 'test',
'langcode' => 'de',
]);
$term
->save();
$node = Node::create([
'type' => 'page',
'title' => 'test_title',
'field_tags' => [
[
'target_id' => $term
->id(),
],
],
]);
$node
->save();
$this->accessStorage
->addTermPermissionsByUserIds([
\Drupal::service('current_user')
->id(),
], $term
->id(), 'de');
$this
->assertTrue($this->accessCheck
->canUserAccessByNode(Node::load($node
->id())));
}