You are here

public function HtmlPurifierFilterTest::testMaliciousCode in HTML Purifier 8

File

tests/src/Kernel/HtmlPurifierFilterTest.php, line 37

Class

HtmlPurifierFilterTest
Tests htmlpurifier filter.

Namespace

Drupal\Tests\htmlpurifier\Kernel

Code

public function testMaliciousCode() {
  $input = '<img src="javascript:evil();" onload="evil();" />';
  $expected = '';
  $processed = $this->filter
    ->process($input, 'und')
    ->getProcessedText();
  $this
    ->assertSame($expected, $processed);
}