You are here

function AddFeedTest::testFeedIconEscaping in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Common/AddFeedTest.php \Drupal\system\Tests\Common\AddFeedTest::testFeedIconEscaping()

Checks that special characters are correctly escaped.

See also

https://www.drupal.org/node/1211668

File

core/modules/system/src/Tests/Common/AddFeedTest.php, line 92
Contains \Drupal\system\Tests\Common\AddFeedTest.

Class

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

Namespace

Drupal\system\Tests\Common

Code

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