You are here

function FilterAPITest::testCheckMarkupFilterOrder in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/filter/src/Tests/FilterAPITest.php \Drupal\filter\Tests\FilterAPITest::testCheckMarkupFilterOrder()

Tests that the filter order is respected.

File

core/modules/filter/src/Tests/FilterAPITest.php, line 37
Contains \Drupal\filter\Tests\FilterAPITest.

Class

FilterAPITest
Tests the behavior of the API of the Filter module.

Namespace

Drupal\filter\Tests

Code

function testCheckMarkupFilterOrder() {

  // Create crazy HTML format.
  $crazy_format = entity_create('filter_format', array(
    'format' => 'crazy',
    'name' => 'Crazy',
    'weight' => 1,
    'filters' => array(
      'filter_html_escape' => array(
        'weight' => 10,
        'status' => 1,
      ),
      'filter_html' => array(
        'weight' => -10,
        'status' => 1,
        'settings' => array(
          'allowed_html' => '<p>',
        ),
      ),
    ),
  ));
  $crazy_format
    ->save();
  $text = "<p>Llamas are <not> awesome!</p>";
  $expected_filtered_text = "&lt;p&gt;Llamas are  awesome!&lt;/p&gt;";
  $this
    ->assertEqual(check_markup($text, 'crazy'), $expected_filtered_text, 'Filters applied in correct order.');
}