You are here

public function DataFetcherTest::testFetchingAcrossReferences in Typed Data API enhancements 8

@covers ::fetchDataByPropertyPath

File

tests/src/Kernel/DataFetcherTest.php, line 149

Class

DataFetcherTest
Class DataFetcherTest.

Namespace

Drupal\Tests\typed_data\Kernel

Code

public function testFetchingAcrossReferences() {
  $user = $this->entityTypeManager
    ->getStorage('user')
    ->create([
    'name' => 'test',
    'type' => 'user',
  ]);
  $this->node->uid->entity = $user;
  $fetched_value = $this->dataFetcher
    ->fetchDataByPropertyPath($this->node
    ->getTypedData(), 'uid.entity.name.value')
    ->getValue();
  $this
    ->assertSame($fetched_value, 'test');
}