public function StandardTest::testBlacklistMode in Drupal 8
Same name and namespace in other branches
- 9 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 563
Class
- StandardTest
- @coversDefaultClass \Drupal\editor\EditorXssFilter\Standard @group editor
Namespace
Drupal\Tests\editor\Unit\EditorXssFilterCode
public function testBlacklistMode($value, $expected, $message, array $disallowed_tags) {
$value = Standard::filter($value, $disallowed_tags);
$this
->assertSame($expected, $value, $message);
}