public function PlaceholderResolverTest::testStringEncoding in Typed Data API enhancements 8
@covers ::replacePlaceHolders
File
- tests/
src/ Kernel/ PlaceholderResolverTest.php, line 322
Class
- PlaceholderResolverTest
- Tests the placeholder resolver.
Namespace
Drupal\Tests\typed_data\KernelCode
public function testStringEncoding() {
$this->node->title->value = '<b>XSS</b>';
$text = 'test {{node.title}}';
$result = $this->placeholderResolver
->replacePlaceHolders($text, [
'node' => $this->node
->getTypedData(),
]);
$this
->assertEquals('test ' . new HtmlEscapedText('<b>XSS</b>'), $result);
}