function AddFeedTest::testFeedIconEscaping
Same name in other branches
- 9 core/modules/system/tests/src/Kernel/Common/AddFeedTest.php \Drupal\Tests\system\Kernel\Common\AddFeedTest::testFeedIconEscaping()
- 8.9.x core/modules/system/tests/src/Kernel/Common/AddFeedTest.php \Drupal\Tests\system\Kernel\Common\AddFeedTest::testFeedIconEscaping()
- 11.x core/modules/system/tests/src/Kernel/Common/AddFeedTest.php \Drupal\Tests\system\Kernel\Common\AddFeedTest::testFeedIconEscaping()
Checks that special characters are correctly escaped.
See also
https://www.drupal.org/node/1211668
File
-
core/
modules/ system/ tests/ src/ Kernel/ Common/ AddFeedTest.php, line 92
Class
- AddFeedTest
- Make sure that attaching feeds works correctly with various constructs.
Namespace
Drupal\Tests\system\Kernel\CommonCode
public function testFeedIconEscaping() : void {
$variables = [
'#theme' => 'feed_icon',
'#url' => 'node',
'#title' => '<>&"\'',
];
$text = (string) \Drupal::service('renderer')->renderRoot($variables);
$this->assertEquals('Subscribe to <>&"'', trim(strip_tags($text)), 'feed_icon template escapes reserved HTML characters.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.