You are here

protected function LinkStubReplicationTest::createTextField in Replication 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/LinkStubReplicationTest.php \Drupal\Tests\replication\Kernel\LinkStubReplicationTest::createTextField()

Create text field for entity type.

Parameters

string $entity_type: Entity type.

string $bundle: Entity type bundle.

$field_name: Name of the text field to create.

1 call to LinkStubReplicationTest::createTextField()
LinkStubReplicationTest::setUp in tests/src/Kernel/LinkStubReplicationTest.php

File

tests/src/Kernel/LinkStubReplicationTest.php, line 184

Class

LinkStubReplicationTest
Tests link stub replication.

Namespace

Drupal\Tests\replication\Kernel

Code

protected function createTextField($entity_type, $bundle, $field_name) {
  FieldStorageConfig::create([
    'field_name' => $field_name,
    'type' => 'string',
    'entity_type' => $entity_type,
    'cardinality' => 1,
  ])
    ->save();
  FieldConfig::create([
    'field_name' => $field_name,
    'entity_type' => $entity_type,
    'bundle' => $bundle,
    'label' => 'Test text-field',
  ])
    ->save();
}