You are here

public function ConfigFieldDefinitionTest::testFieldStorageDefinition in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/field/tests/src/Kernel/ConfigFieldDefinitionTest.php \Drupal\Tests\field\Kernel\ConfigFieldDefinitionTest::testFieldStorageDefinition()
  2. 10 core/modules/field/tests/src/Kernel/ConfigFieldDefinitionTest.php \Drupal\Tests\field\Kernel\ConfigFieldDefinitionTest::testFieldStorageDefinition()

Makes sure a field storage definition is exposed for a configurable field.

File

core/modules/field/tests/src/Kernel/ConfigFieldDefinitionTest.php, line 56

Class

ConfigFieldDefinitionTest
Tests exposing field definitions for configurable fields.

Namespace

Drupal\Tests\field\Kernel

Code

public function testFieldStorageDefinition() {
  $field_storage_definitions = \Drupal::service('entity_field.manager')
    ->getFieldStorageDefinitions($this->entityType);
  $this
    ->assertTrue(isset($field_storage_definitions[$this->fieldTestData->field
    ->getName()]));
  $this
    ->assertInstanceOf(FieldStorageDefinitionInterface::class, $field_storage_definitions[$this->fieldTestData->field
    ->getName()]);

  // Make sure storages on other entity types are not exposed.
  $this
    ->assertFalse(isset($field_storage_definitions[$this->fieldTestData->field_rev
    ->getName()]));
}