function FilterAPITest::testCheckMarkupFilterOrder
Same name in other branches
- 9 core/modules/filter/tests/src/Kernel/FilterAPITest.php \Drupal\Tests\filter\Kernel\FilterAPITest::testCheckMarkupFilterOrder()
- 8.9.x core/modules/filter/tests/src/Kernel/FilterAPITest.php \Drupal\Tests\filter\Kernel\FilterAPITest::testCheckMarkupFilterOrder()
- 10 core/modules/filter/tests/src/Kernel/FilterAPITest.php \Drupal\Tests\filter\Kernel\FilterAPITest::testCheckMarkupFilterOrder()
Tests that the filter order is respected.
File
-
core/
modules/ filter/ tests/ src/ Kernel/ FilterAPITest.php, line 41
Class
- FilterAPITest
- Tests the behavior of the API of the Filter module.
Namespace
Drupal\Tests\filter\KernelCode
public function testCheckMarkupFilterOrder() : void {
// Create crazy HTML format.
$crazy_format = FilterFormat::create([
'format' => 'crazy',
'name' => 'Crazy',
'weight' => 1,
'filters' => [
'filter_html_escape' => [
'weight' => 10,
'status' => 1,
],
'filter_html' => [
'weight' => -10,
'status' => 1,
'settings' => [
'allowed_html' => '<p>',
],
],
],
]);
$crazy_format->save();
$text = "<p>Llamas are <not> awesome!</p>";
$expected_filtered_text = "<p>Llamas are awesome!</p>";
$this->assertEquals($expected_filtered_text, check_markup($text, 'crazy'), 'Filters applied in correct order.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.