public function PlaceholderResolverTest::testPlaceholdersAcrossReferences in Typed Data API enhancements 8
@covers ::replacePlaceHolders
File
- tests/
src/ Kernel/ PlaceholderResolverTest.php, line 294
Class
- PlaceholderResolverTest
- Tests the placeholder resolver.
Namespace
Drupal\Tests\typed_data\KernelCode
public function testPlaceholdersAcrossReferences() {
$user = $this->entityTypeManager
->getStorage('user')
->create([
'name' => 'test',
'type' => 'user',
]);
$this->node->uid->entity = $user;
$text = 'test {{node.title}} and {{node.uid.entity.name}}';
$result = $this->placeholderResolver
->replacePlaceHolders($text, [
'node' => $this->node
->getTypedData(),
]);
$this
->assertEquals('test test and test', $result);
}