public function DataDefinitionFetcherTest::testFetchingAtValidPositions in Typed Data API enhancements 8
@covers ::fetchDefinitionByPropertyPath
File
- tests/
src/ Kernel/ DataDefinitionFetcherTest.php, line 160
Class
- DataDefinitionFetcherTest
- Tests that data fetcher definition fetching functions work correctly.
Namespace
Drupal\Tests\typed_data\KernelCode
public function testFetchingAtValidPositions() {
$target_definition = $this->nodeDefinition
->getPropertyDefinition('field_integer')
->getItemDefinition()
->getPropertyDefinition('value');
$fetched_definition = $this->dataFetcher
->fetchDefinitionByPropertyPath($this->nodeDefinition, 'field_integer.0.value');
$this
->assertSame($target_definition, $fetched_definition);
$fetched_definition = $this->dataFetcher
->fetchDefinitionByPropertyPath($this->nodeDefinition, 'field_integer.1.value');
$this
->assertSame($target_definition, $fetched_definition);
}