You are here

public function NodeAccessRecordsTest::testCreateNone in Permissions by Term 8.2

File

tests/src/Kernel/NodeAccessRecordsTest.php, line 27

Class

NodeAccessRecordsTest
Class AccessCheckTest

Namespace

Drupal\Tests\permissions_by_term\Kernel

Code

public function testCreateNone() : void {
  $node = Node::create([
    'type' => 'page',
    'title' => 'test_title',
  ]);
  $node
    ->save();
  self::assertEmpty($this
    ->isNodeAccessRecordCreatedInPBTRealm($node
    ->id()));
  NodeType::create([
    'type' => 'without_taxonomy_term_relation',
  ])
    ->save();
  $node = Node::create([
    'type' => 'without_taxonomy_term_relation',
    'title' => 'test_title',
  ]);
  $node
    ->save();
  self::assertFalse($this
    ->isNodeAccessRecordCreatedInPBTRealm($node
    ->id()));
  $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::assertFalse($this
    ->isNodeAccessRecordCreatedInPBTRealm($node
    ->id()));
}