You are here

public function HtmlPurifierFilterTest::providerTestConfigurationValidation in HTML Purifier 8

File

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

Class

HtmlPurifierFilterTest
Tests htmlpurifier filter.

Namespace

Drupal\Tests\htmlpurifier\Kernel

Code

public function providerTestConfigurationValidation() {
  $purifier_config = \HTMLPurifier_Config::createDefault();
  $default_configuration = Yaml::encode($purifier_config
    ->getAll());
  return [
    'invalid empty configuration' => [
      '',
      [
        'HTMLPurifier configuration is not valid',
      ],
    ],
    'default configuration' => [
      $default_configuration,
      [],
    ],
    'undefined directive' => [
      str_replace('RemoveEmpty:', 'FakeDirective:', $default_configuration),
      [
        'Cannot set undefined directive',
      ],
    ],
    'malformed yaml' => [
      str_replace('RemoveEmpty: false', 'UnexpectedString', $default_configuration),
      [
        'pars',
      ],
    ],
  ];
}