public function AddFeedTest::testFeedLabelEscaping in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/aggregator/src/Tests/AddFeedTest.php \Drupal\aggregator\Tests\AddFeedTest::testFeedLabelEscaping()
Ensures that the feed label is escaping when rendering the feed icon.
File
- core/
modules/ aggregator/ src/ Tests/ AddFeedTest.php, line 57 - Contains \Drupal\aggregator\Tests\AddFeedTest.
Class
- AddFeedTest
- Add feed test.
Namespace
Drupal\aggregator\TestsCode
public function testFeedLabelEscaping() {
$feed = $this
->createFeed(NULL, [
'title[0][value]' => 'Test feed title <script>alert(123);</script>',
]);
$this
->checkForMetaRefresh();
$this
->drupalGet('aggregator/sources/' . $feed
->id());
$this
->assertResponse(200);
$this
->assertEscaped('Test feed title <script>alert(123);</script>');
$this
->assertNoRaw('Test feed title <script>alert(123);</script>');
// Ensure the feed icon title is escaped.
$this
->assertTrue(strpos(str_replace([
"\n",
"\r",
], '', $this
->getRawContent()), 'class="feed-icon"> Subscribe to Test feed title <script>alert(123);</script> feed</a>') !== FALSE);
}