function TypedDataDefinitionTest::testDataReferences
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/TypedData/TypedDataDefinitionTest.php \Drupal\KernelTests\Core\TypedData\TypedDataDefinitionTest::testDataReferences()
- 8.9.x core/tests/Drupal/KernelTests/Core/TypedData/TypedDataDefinitionTest.php \Drupal\KernelTests\Core\TypedData\TypedDataDefinitionTest::testDataReferences()
- 10 core/tests/Drupal/KernelTests/Core/TypedData/TypedDataDefinitionTest.php \Drupal\KernelTests\Core\TypedData\TypedDataDefinitionTest::testDataReferences()
Tests deriving metadata from data references.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ TypedData/ TypedDataDefinitionTest.php, line 92
Class
- TypedDataDefinitionTest
- Tests deriving metadata of core data types.
Namespace
Drupal\KernelTests\Core\TypedDataCode
public function testDataReferences() : void {
$language_reference_definition = DataReferenceDefinition::create('language');
$this->assertInstanceOf(DataReferenceDefinitionInterface::class, $language_reference_definition);
// Test retrieving metadata about the referenced data.
$this->assertEquals('language', $language_reference_definition->getTargetDefinition()
->getDataType());
// Test using the definition factory.
$language_reference_definition2 = $this->typedDataManager
->createDataDefinition('language_reference');
$this->assertInstanceOf(DataReferenceDefinitionInterface::class, $language_reference_definition2);
$this->assertEquals(serialize($language_reference_definition2), serialize($language_reference_definition));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.