function FieldMissingTypeTest::setUp

Same name in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Field/FieldMissingTypeTest.php \Drupal\KernelTests\Core\Field\FieldMissingTypeTest::setUp()
  2. 10 core/tests/Drupal/KernelTests/Core/Field/FieldMissingTypeTest.php \Drupal\KernelTests\Core\Field\FieldMissingTypeTest::setUp()
  3. 11.x core/tests/Drupal/KernelTests/Core/Field/FieldMissingTypeTest.php \Drupal\KernelTests\Core\Field\FieldMissingTypeTest::setUp()

Overrides EntityKernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Field/FieldMissingTypeTest.php, line 35

Class

FieldMissingTypeTest
Tests the exception when missing a field type.

Namespace

Drupal\KernelTests\Core\Field

Code

protected function setUp() : void {
    parent::setUp();
    $entity_type_id = 'entity_test_mulrev';
    $this->installEntitySchema($entity_type_id);
    $this->fieldName = mb_strtolower($this->randomMachineName());
    
    /** @var \Drupal\field\Entity\FieldStorageConfig $field_storage */
    FieldStorageConfig::create([
        'field_name' => $this->fieldName,
        'type' => 'text',
        'entity_type' => $entity_type_id,
        'cardinality' => 1,
    ])
        ->save();
    FieldConfig::create([
        'entity_type' => $entity_type_id,
        'field_name' => $this->fieldName,
        'bundle' => $entity_type_id,
        'label' => 'Test field',
    ])
        ->save();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.