function StandardTest::testBlacklistMode
Same name in other branches
- 9 core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php \Drupal\Tests\editor\Unit\EditorXssFilter\StandardTest::testBlacklistMode()
- 8.9.x core/modules/editor/tests/src/Unit/EditorXssFilter/StandardTest.php \Drupal\Tests\editor\Unit\EditorXssFilter\StandardTest::testBlacklistMode()
Tests removing disallowed tags and XSS prevention.
\Drupal\Component\Utility\Xss::filter() has the ability to run in blacklist mode, in which it still applies the exact same filtering, with one exception: it no longer works with a list of allowed tags, but with a list of disallowed tags.
@dataProvider providerTestBlackListMode
Parameters
string $value: The value to filter.
string $expected: The string that is expected to be missing.
string $message: The assertion message to display upon failure.
array $disallowed_tags: (optional) The disallowed HTML tags to be passed to \Drupal\Component\Utility\Xss::filter().
File
-
core/
modules/ editor/ tests/ src/ Unit/ EditorXssFilter/ StandardTest.php, line 566
Class
- StandardTest
- @coversDefaultClass \Drupal\editor\EditorXssFilter\Standard @group editor
Namespace
Drupal\Tests\editor\Unit\EditorXssFilterCode
public function testBlacklistMode($value, $expected, $message, array $disallowed_tags) : void {
$value = Standard::filter($value, $disallowed_tags);
$this->assertSame($expected, $value, $message);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.