You are here

public function AddFeedTest::testFeedIconEscaping in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Kernel/Common/AddFeedTest.php \Drupal\Tests\system\Kernel\Common\AddFeedTest::testFeedIconEscaping()
  2. 9 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 90

Class

AddFeedTest
Make sure that attaching feeds works correctly with various constructs.

Namespace

Drupal\Tests\system\Kernel\Common

Code

public function testFeedIconEscaping() {
  $variables = [
    '#theme' => 'feed_icon',
    '#url' => 'node',
    '#title' => '<>&"\'',
  ];
  $text = \Drupal::service('renderer')
    ->renderRoot($variables);
  $this
    ->assertEquals('Subscribe to &lt;&gt;&amp;&quot;&#039;', trim(strip_tags($text)), 'feed_icon template escapes reserved HTML characters.');
}