You are here

public function ConfigFieldDefinitionTest::testFieldStorageDefinition in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field/src/Tests/ConfigFieldDefinitionTest.php \Drupal\field\Tests\ConfigFieldDefinitionTest::testFieldStorageDefinition()

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

File

core/modules/field/src/Tests/ConfigFieldDefinitionTest.php, line 68
Contains \Drupal\field\Tests\ConfigFieldDefinitionTest.

Class

ConfigFieldDefinitionTest
Tests exposing field definitions for configurable fields.

Namespace

Drupal\field\Tests

Code

public function testFieldStorageDefinition() {
  $field_storage_definitions = $this->entityManager
    ->getFieldStorageDefinitions($this->entityType);
  $this
    ->assertTrue(isset($field_storage_definitions[$this->fieldTestData->field
    ->getName()]));
  $this
    ->assertTrue($field_storage_definitions[$this->fieldTestData->field
    ->getName()] instanceof FieldStorageDefinitionInterface);

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