You are here

public function ConfigFieldDefinitionTest::testBundleFieldDefinition 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::testBundleFieldDefinition()

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

File

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

Class

ConfigFieldDefinitionTest
Tests exposing field definitions for configurable fields.

Namespace

Drupal\field\Tests

Code

public function testBundleFieldDefinition() {
  $definitions = $this->entityManager
    ->getFieldDefinitions($this->entityType, $this->bundle);
  $this
    ->assertTrue(isset($definitions[$this->fieldTestData->field
    ->getName()]));
  $this
    ->assertTrue($definitions[$this->fieldTestData->field
    ->getName()] instanceof FieldDefinitionInterface);

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