You are here

protected function PBTKernelTestBase::createRelationNoGrantedTerm in Permissions by Term 8.2

Same name and namespace in other branches
  1. 8 tests/src/Kernel/PBTKernelTestBase.php \Drupal\Tests\permissions_by_term\Kernel\PBTKernelTestBase::createRelationNoGrantedTerm()
1 call to PBTKernelTestBase::createRelationNoGrantedTerm()
AccessCheckTest::testNoGrantedTermRestriction in tests/src/Kernel/AccessCheckTest.php

File

tests/src/Kernel/PBTKernelTestBase.php, line 223

Class

PBTKernelTestBase
Class PBTKernelTestBase

Namespace

Drupal\Tests\permissions_by_term\Kernel

Code

protected function createRelationNoGrantedTerm() : void {
  $term = Term::create([
    'name' => 'term2',
    'vid' => 'test',
  ]);
  $term
    ->save();
  $tids[] = $term
    ->id();
  $this->accessStorage
    ->addTermPermissionsByUserIds([
    1,
  ], $term
    ->id());
  $node = Node::create([
    'type' => 'page',
    'title' => 'test_title',
    'field_tags' => [
      [
        'target_id' => $tids[0],
      ],
    ],
  ]);
  $node
    ->save();
  $this
    ->setNidNoGrantedTerm($node
    ->id());
}