public function ConfigFieldDefinitionTest::testBundleFieldDefinition in Drupal 10
Same name and namespace in other branches
- 8 core/modules/field/tests/src/Kernel/ConfigFieldDefinitionTest.php \Drupal\Tests\field\Kernel\ConfigFieldDefinitionTest::testBundleFieldDefinition()
- 9 core/modules/field/tests/src/Kernel/ConfigFieldDefinitionTest.php \Drupal\Tests\field\Kernel\ConfigFieldDefinitionTest::testBundleFieldDefinition()
Makes sure a field definition is exposed for a configurable field.
File
- core/
modules/ field/ tests/ src/ Kernel/ ConfigFieldDefinitionTest.php, line 45
Class
- ConfigFieldDefinitionTest
- Tests exposing field definitions for configurable fields.
Namespace
Drupal\Tests\field\KernelCode
public function testBundleFieldDefinition() {
$definitions = \Drupal::service('entity_field.manager')
->getFieldDefinitions($this->entityType, $this->bundle);
$this
->assertTrue(isset($definitions[$this->fieldTestData->field
->getName()]));
$this
->assertInstanceOf(FieldDefinitionInterface::class, $definitions[$this->fieldTestData->field
->getName()]);
// Make sure fields on other entity types are not exposed.
$this
->assertFalse(isset($definitions[$this->fieldTestData->field_rev
->getName()]));
}