You are here

public function HtmlPurifierFilterTest::testRemoveEmpty in HTML Purifier 8

File

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

Class

HtmlPurifierFilterTest
Tests htmlpurifier filter.

Namespace

Drupal\Tests\htmlpurifier\Kernel

Code

public function testRemoveEmpty() {
  $input = '<a></a>';
  $expected = '<a></a>';
  $processed = $this->filter
    ->process($input, 'und')
    ->getProcessedText();
  $this
    ->assertSame($expected, $processed);
  $configuration = [
    'AutoFormat' => [
      'RemoveEmpty' => TRUE,
    ],
  ];
  $this->filter->settings['htmlpurifier_configuration'] = Yaml::encode($configuration);
  $expected = '';
  $processed = $this->filter
    ->process($input, 'und')
    ->getProcessedText();
  $this
    ->assertSame($expected, $processed);
}