You are here

protected function PBTKernelTestBase::createRelationWithoutRestriction 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::createRelationWithoutRestriction()
7 calls to PBTKernelTestBase::createRelationWithoutRestriction()
AccessCheckTest::testNoTermRestriction in tests/src/Kernel/AccessCheckTest.php
AccessCheckTest::testRequireAllTermsGrantedWithNoRestrictedTerms in tests/src/Kernel/AccessCheckTest.php
PermissionModeTest::testCanAdminUserAccessByNodeId in tests/src/Kernel/PermissionModeTest.php
PermissionModeTest::testCanUserAccessByNodeId in tests/src/Kernel/PermissionModeTest.php
PermissionModeTest::testHandleNode in tests/src/Kernel/PermissionModeTest.php

... See full list

File

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

Class

PBTKernelTestBase
Class PBTKernelTestBase

Namespace

Drupal\Tests\permissions_by_term\Kernel

Code

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