You are here

public function DataDefinitionFetcherTest::testFetchingNonComplexType in Typed Data API enhancements 8

@covers ::fetchDefinitionByPropertyPath

File

tests/src/Kernel/DataDefinitionFetcherTest.php, line 227

Class

DataDefinitionFetcherTest
Tests that data fetcher definition fetching functions work correctly.

Namespace

Drupal\Tests\typed_data\Kernel

Code

public function testFetchingNonComplexType() {
  $this
    ->expectException(InvalidArgumentException::class);
  $this
    ->expectExceptionMessage("The data selector 'field_integer.0.value.not_existing' cannot be applied because the parent property 'value' is not a list or a complex structure");

  // This should trigger an exception.
  $this->dataFetcher
    ->fetchDefinitionByPropertyPath($this->nodeDefinition, 'field_integer.0.value.not_existing');
}