You are here

public function EntityToTableRendererTest::createField in Reference Table Formatter 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Kernel/EntityToTableRendererTest.php \Drupal\Tests\reference_table_formatter\Kernel\EntityToTableRendererTest::createField()

Creates a field on the node entity type.

Parameters

array $storage_settings: Settings to create the field storage with.

array $field_settings: Settings to create the field instance with.

2 calls to EntityToTableRendererTest::createField()
EntityToTableRendererTest::setUp in tests/src/Kernel/EntityToTableRendererTest.php
EntityToTableRendererTest::testEmptyFields in tests/src/Kernel/EntityToTableRendererTest.php
Tests handling of empty fields.

File

tests/src/Kernel/EntityToTableRendererTest.php, line 326

Class

EntityToTableRendererTest
Tests reference table formatter entity to table renderer.

Namespace

Drupal\Tests\reference_table_formatter\Kernel

Code

public function createField(array $storage_settings, array $field_settings) {
  $field_storage = FieldStorageConfig::create($storage_settings + [
    'entity_type' => 'node',
  ]);
  $field_storage
    ->save();
  FieldConfig::create($field_settings + [
    'field_storage' => $field_storage,
  ])
    ->save();
}