function FieldMissingTypeTest::setUp

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Field/FieldMissingTypeTest.php \Drupal\KernelTests\Core\Field\FieldMissingTypeTest::setUp()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Field/FieldMissingTypeTest.php \Drupal\KernelTests\Core\Field\FieldMissingTypeTest::setUp()
  3. 10 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 37

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 = $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.