function ValidatorsTest::testMultipleHtmlRestrictingFilters
Same name and namespace in other branches
- 10 core/modules/ckeditor5/tests/src/Kernel/ValidatorsTest.php \Drupal\Tests\ckeditor5\Kernel\ValidatorsTest::testMultipleHtmlRestrictingFilters()
Tests that validation works with >1 enabled HTML restrictor filters.
@legacy-covers \Drupal\ckeditor5\Plugin\Validation\Constraint\FundamentalCompatibilityConstraintValidator::checkHtmlRestrictionsMatch
File
-
core/
modules/ ckeditor5/ tests/ src/ Kernel/ ValidatorsTest.php, line 1616
Class
- ValidatorsTest
- Tests Validators.
Namespace
Drupal\Tests\ckeditor5\KernelCode
public function testMultipleHtmlRestrictingFilters() : void {
$this->container
->get('module_installer')
->install([
'filter_test',
]);
$text_format = FilterFormat::create([
'format' => 'very_restricted',
'name' => $this->randomMachineName(),
'filters' => [
// The first filter of type TYPE_HTML_RESTRICTOR.
'filter_html' => [
'id' => 'filter_html',
'provider' => 'filter',
'status' => TRUE,
'weight' => 0,
'settings' => [
'allowed_html' => "<p> <br>",
'filter_html_help' => TRUE,
'filter_html_nofollow' => TRUE,
],
],
// The second filter of type TYPE_HTML_RESTRICTOR. Configure this to
// allow exactly what the first filter allows.
'filter_test_restrict_tags_and_attributes' => [
'id' => 'filter_test_restrict_tags_and_attributes',
'provider' => 'filter_test',
'status' => TRUE,
'settings' => [
'restrictions' => [
'allowed' => [
'p' => FALSE,
'br' => FALSE,
'*' => [
'dir' => [
'ltr' => TRUE,
'rtl' => TRUE,
],
'lang' => TRUE,
],
],
],
],
],
],
]);
$text_editor = Editor::create([
'format' => 'very_restricted',
'editor' => 'ckeditor5',
'image_upload' => [
'status' => FALSE,
],
'settings' => [
'toolbar' => [
'items' => [],
],
'plugins' => [],
],
]);
$this->assertSame([], $this->validatePairToViolationsArray($text_editor, $text_format, TRUE));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.