function FieldStorageCreateCheckTest::testFieldStorageCreateCheck

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Field/FieldStorageCreateCheckTest.php \Drupal\KernelTests\Core\Field\FieldStorageCreateCheckTest::testFieldStorageCreateCheck()

Tests the field storage create check subscriber.

File

core/tests/Drupal/KernelTests/Core/Field/FieldStorageCreateCheckTest.php, line 29

Class

FieldStorageCreateCheckTest
Tests the field storage create check subscriber.

Namespace

Drupal\KernelTests\Core\Field

Code

public function testFieldStorageCreateCheck() : void {
  $this->expectException(\LogicException::class);
  $this->expectExceptionMessage('Creating the "entity_test.field_test" field storage definition without the entity schema "entity_test" being installed is not allowed.');
  FieldStorageConfig::create([
    'field_name' => 'field_test',
    'entity_type' => 'entity_test',
    'type' => 'integer',
  ])->save();
}

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