You are here

public function DataLayerKernelTest::setupMockFieldConfig in dataLayer 8

Create field definitions for taxonomy term.

1 call to DataLayerKernelTest::setupMockFieldConfig()
DataLayerKernelTest::setUp in tests/src/Kernel/DataLayerKernelTest.php

File

tests/src/Kernel/DataLayerKernelTest.php, line 78

Class

DataLayerKernelTest
Kernel test cases for datalayer module.

Namespace

Drupal\Tests\datalayer\Kernel

Code

public function setupMockFieldConfig() {
  NodeType::create([
    'type' => 'article',
  ])
    ->save();
  FieldStorageConfig::create([
    'entity_type' => 'node',
    'field_name' => 'field_tags',
    'type' => 'entity_reference',
    'settings' => [
      'target_type' => 'taxonomy_term',
    ],
  ])
    ->save();
  FieldConfig::create([
    'field_name' => 'field_tags',
    'entity_type' => 'node',
    'bundle' => 'article',
  ])
    ->save();
}