public function EditorSecurityTest::testEditorXssFilterOverride in Drupal 9
Same name and namespace in other branches
- 8 core/modules/editor/tests/src/Functional/EditorSecurityTest.php \Drupal\Tests\editor\Functional\EditorSecurityTest::testEditorXssFilterOverride()
Tests the standard text editor XSS filter being overridden.
File
- core/
modules/ editor/ tests/ src/ Functional/ EditorSecurityTest.php, line 431
Class
- EditorSecurityTest
- Tests XSS protection for content creators when using text editors.
Namespace
Drupal\Tests\editor\FunctionalCode
public function testEditorXssFilterOverride() {
// First: the Standard text editor XSS filter.
$this
->drupalLogin($this->normalUser);
$this
->drupalGet('node/2/edit');
$this
->assertSession()
->fieldValueEquals('edit-body-0-value', self::$sampleContentSecured);
// Enable editor_test.module's hook_editor_xss_filter_alter() implementation
// to alter the text editor XSS filter class being used.
\Drupal::state()
->set('editor_test_editor_xss_filter_alter_enabled', TRUE);
// First: the Insecure text editor XSS filter.
$this
->drupalGet('node/2/edit');
$this
->assertSession()
->fieldValueEquals('edit-body-0-value', self::$sampleContent);
}