You are here

protected function PBTKernelTestBase::createPageNodeType 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::createPageNodeType()
1 call to PBTKernelTestBase::createPageNodeType()
PBTKernelTestBase::setUp in tests/src/Kernel/PBTKernelTestBase.php

File

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

Class

PBTKernelTestBase
Class PBTKernelTestBase

Namespace

Drupal\Tests\permissions_by_term\Kernel

Code

protected function createPageNodeType() {
  NodeType::create([
    'type' => 'page',
  ])
    ->save();
  FieldStorageConfig::create([
    'entity_type' => 'node',
    'field_name' => 'field_tags',
    'type' => 'entity_reference',
    'settings' => [
      'target_type' => 'taxonomy_term',
    ],
    'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
  ])
    ->save();
  FieldStorageConfig::create([
    'entity_type' => 'node',
    'field_name' => 'field_tags2',
    'type' => 'entity_reference',
    'settings' => [
      'target_type' => 'taxonomy_term',
    ],
    'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
  ])
    ->save();
  FieldConfig::create([
    'field_name' => 'field_tags',
    'entity_type' => 'node',
    'bundle' => 'page',
  ])
    ->save();
  FieldConfig::create([
    'field_name' => 'field_tags2',
    'entity_type' => 'node',
    'bundle' => 'page',
  ])
    ->save();
}