function ConfigFieldDefinitionTest::testFieldStorageDefinition

Same name in other branches
  1. 9 core/modules/field/tests/src/Kernel/ConfigFieldDefinitionTest.php \Drupal\Tests\field\Kernel\ConfigFieldDefinitionTest::testFieldStorageDefinition()
  2. 8.9.x core/modules/field/tests/src/Kernel/ConfigFieldDefinitionTest.php \Drupal\Tests\field\Kernel\ConfigFieldDefinitionTest::testFieldStorageDefinition()
  3. 11.x 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 58

Class

ConfigFieldDefinitionTest
Tests exposing field definitions for configurable fields.

Namespace

Drupal\Tests\field\Kernel

Code

public function testFieldStorageDefinition() : void {
    $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()]));
}

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