function TypedDataDefinitionTest::testDataReferences
Same name in other branches
- 9 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()
- 11.x 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 86
Class
- TypedDataDefinitionTest
- Tests deriving metadata of core data types.
Namespace
Drupal\KernelTests\Core\TypedDataCode
public function testDataReferences() {
$language_reference_definition = DataReferenceDefinition::create('language');
$this->assertInstanceOf(DataReferenceDefinitionInterface::class, $language_reference_definition);
// Test retrieving metadata about the referenced data.
$this->assertEqual($language_reference_definition->getTargetDefinition()
->getDataType(), 'language');
// Test using the definition factory.
$language_reference_definition2 = $this->typedDataManager
->createDataDefinition('language_reference');
$this->assertInstanceOf(DataReferenceDefinitionInterface::class, $language_reference_definition2);
$this->assertEqual(serialize($language_reference_definition), serialize($language_reference_definition2));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.