public function NodeAccessRecordsTest::testCreateIfTermHasPermission in Permissions by Term 8.2
File
- tests/
src/ Kernel/ NodeAccessRecordsTest.php, line 65
Class
- NodeAccessRecordsTest
- Class AccessCheckTest
Namespace
Drupal\Tests\permissions_by_term\KernelCode
public function testCreateIfTermHasPermission() : void {
$term = Term::create([
'name' => 'term2',
'vid' => 'test',
]);
$term
->save();
$this->accessStorage
->addTermPermissionsByUserIds([
99,
], $term
->id());
$node = Node::create([
'type' => 'page',
'title' => 'test_title',
'field_tags' => [
[
'target_id' => $term
->id(),
],
],
]);
$node
->save();
self::assertTrue($this
->isNodeAccessRecordCreatedInPBTRealm($node
->id()));
\Drupal::configFactory()
->getEditable('permissions_by_term.settings')
->set('permission_mode', TRUE)
->save(TRUE);
$term = Term::create([
'name' => 'term2',
'vid' => 'test',
]);
$term
->save();
$node = Node::create([
'type' => 'page',
'title' => 'test_title',
'field_tags' => [
[
'target_id' => $term
->id(),
],
],
]);
$node
->save();
self::assertTrue($this
->isNodeAccessRecordCreatedInPBTRealm($node
->id()));
}