function FilterSecurityTest::testSkipSecurityFilters in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/filter/src/Tests/FilterSecurityTest.php \Drupal\filter\Tests\FilterSecurityTest::testSkipSecurityFilters()
Tests that security filters are enforced even when marked to be skipped.
File
- core/
modules/ filter/ src/ Tests/ FilterSecurityTest.php, line 88 - Contains \Drupal\filter\Tests\FilterSecurityTest.
Class
- FilterSecurityTest
- Tests the behavior of check_markup() when a filter or text format vanishes, or when check_markup() is called in such a way that it is instructed to skip all filters of the "FilterInterface::TYPE_HTML_RESTRICTOR" type.
Namespace
Drupal\filter\TestsCode
function testSkipSecurityFilters() {
$text = "Text with some disallowed tags: <script />, <p><object>unicorn</object></p>, <i><table></i>.";
$expected_filtered_text = "Text with some disallowed tags: , <p>unicorn</p>, .";
$this
->assertEqual(check_markup($text, 'filtered_html', '', array()), $expected_filtered_text, 'Expected filter result.');
$this
->assertEqual(check_markup($text, 'filtered_html', '', array(
FilterInterface::TYPE_HTML_RESTRICTOR,
)), $expected_filtered_text, 'Expected filter result, even when trying to disable filters of the FilterInterface::TYPE_HTML_RESTRICTOR type.');
}