You are here

protected function KernelTestBase::createTestField in Key value field 8

Testing new field creation.

15 calls to KernelTestBase::createTestField()
KeyValueFormatterTest::testFormatter in tests/src/Kernel/KeyValueFormatterTest.php
Tests default formatter settings.
KeyValueFormatterTest::testValueOnlyFormatter in tests/src/Kernel/KeyValueFormatterTest.php
Tests value only formatter setting.
KeyValueItemTest::testFieldCreate in tests/src/Kernel/KeyValueItemTest.php
Test key_value field creation.
KeyValueItemTest::testFieldCreateWithDefaultValue in tests/src/Kernel/KeyValueItemTest.php
Test field creation with default values.
KeyValueItemTest::testMaximumKeyLength in tests/src/Kernel/KeyValueItemTest.php
Test storing data to field with maximum key length constraint.

... See full list

File

tests/src/Kernel/KernelTestBase.php, line 44

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\Tests\key_value_field\Kernel

Code

protected function createTestField($field_type, $field_storage_properties = [], $field_properties = []) {
  $field_storage = FieldStorageConfig::create([
    'field_name' => 'test_key_value_field',
    'entity_type' => 'entity_test',
    'type' => $field_type,
  ] + $field_storage_properties);
  $field_storage
    ->save();
  $field = FieldConfig::create([
    'field_name' => 'test_key_value_field',
    'entity_type' => 'entity_test',
    'type' => $field_type,
    'bundle' => 'entity_test',
  ] + $field_properties);
  $field
    ->save();
}