function EntityTypedDataDefinitionTest::testEntityReferences
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php \Drupal\KernelTests\Core\Entity\EntityTypedDataDefinitionTest::testEntityReferences()
- 10 core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php \Drupal\KernelTests\Core\Entity\EntityTypedDataDefinitionTest::testEntityReferences()
- 11.x core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php \Drupal\KernelTests\Core\Entity\EntityTypedDataDefinitionTest::testEntityReferences()
Tests deriving metadata from entity references.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityTypedDataDefinitionTest.php, line 130
Class
- EntityTypedDataDefinitionTest
- Tests deriving metadata of entity and field data types.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testEntityReferences() {
$reference_definition = DataReferenceDefinition::create('entity');
$this->assertInstanceOf(DataReferenceDefinitionInterface::class, $reference_definition);
// Test retrieving metadata about the referenced data.
$this->assertEqual($reference_definition->getTargetDefinition()
->getDataType(), 'entity');
$this->assertInstanceOf(EntityDataDefinitionInterface::class, $reference_definition->getTargetDefinition());
// Test that the definition factory creates the right definition object.
$reference_definition2 = $this->typedDataManager
->createDataDefinition('entity_reference');
$this->assertInstanceOf(DataReferenceDefinitionInterface::class, $reference_definition2);
$this->assertEqual(serialize($reference_definition2), serialize($reference_definition));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.