function FilterSecurityTest::testSkipSecurityFilters

Tests that security filters are enforced even when marked to be skipped.

File

drupal/core/modules/filter/lib/Drupal/filter/Tests/FilterSecurityTest.php, line 95
Definition of Drupal\filter\Tests\FilterSecurityTest.

Class

FilterSecurityTest
Security tests for missing/vanished text formats or filters.

Namespace

Drupal\filter\Tests

Code

function testSkipSecurityFilters() {
  $text = "Text with some disallowed tags: <script />, <em><object>unicorn</object></em>, <i><table></i>.";
  $expected_filtered_text = "Text with some disallowed tags: , <em>unicorn</em>, .";
  $this
    ->assertEqual(check_markup($text, 'filtered_html', '', FALSE, array()), $expected_filtered_text, 'Expected filter result.');
  $this
    ->assertEqual(check_markup($text, 'filtered_html', '', FALSE, array(
    FILTER_TYPE_HTML_RESTRICTOR,
  )), $expected_filtered_text, 'Expected filter result, even when trying to disable filters of the FILTER_TYPE_HTML_RESTRICTOR type.');
}