function FilterSecurityTest::testSkipSecurityFilters
Same name in other branches
- 9 core/modules/filter/tests/src/Functional/FilterSecurityTest.php \Drupal\Tests\filter\Functional\FilterSecurityTest::testSkipSecurityFilters()
- 8.9.x core/modules/filter/tests/src/Functional/FilterSecurityTest.php \Drupal\Tests\filter\Functional\FilterSecurityTest::testSkipSecurityFilters()
- 11.x core/modules/filter/tests/src/Functional/FilterSecurityTest.php \Drupal\Tests\filter\Functional\FilterSecurityTest::testSkipSecurityFilters()
Tests that security filters are enforced even when marked to be skipped.
File
-
core/
modules/ filter/ tests/ src/ Functional/ FilterSecurityTest.php, line 96
Class
- FilterSecurityTest
- Tests HTML filtering with missing or skipped filters or text formats.
Namespace
Drupal\Tests\filter\FunctionalCode
public function testSkipSecurityFilters() : void {
$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->assertSame($expected_filtered_text, (string) check_markup($text, 'filtered_html', '', []), 'Expected filter result.');
$this->assertSame($expected_filtered_text, (string) check_markup($text, 'filtered_html', '', [
FilterInterface::TYPE_HTML_RESTRICTOR,
]), 'Expected filter result, even when trying to disable filters of the FilterInterface::TYPE_HTML_RESTRICTOR type.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.