You are here

public function ProcessorIntegrationTest::checkHtmlFilterIntegration in Search API 8

Tests the UI for the "HTML filter" processor.

1 call to ProcessorIntegrationTest::checkHtmlFilterIntegration()
ProcessorIntegrationTest::testProcessorIntegration in tests/src/Functional/ProcessorIntegrationTest.php
Tests the admin UI for processors.

File

tests/src/Functional/ProcessorIntegrationTest.php, line 477

Class

ProcessorIntegrationTest
Tests the admin UI for processors.

Namespace

Drupal\Tests\search_api\Functional

Code

public function checkHtmlFilterIntegration() {
  $configuration = [
    'tags' => <<<TAGS
h1: 4
foo bar
TAGS
,
  ];
  $this
    ->checkValidationError($configuration, 'html_filter', 'Tags is not a valid YAML map.');
  $configuration = [
    'tags' => <<<TAGS
h1:
  - 1
  - 2
h2: foo
h3: -1
TAGS
,
  ];
  $errors = [
    new FormattableMarkup("Boost value for tag @tag can't be an array.", [
      '@tag' => '<h1>',
    ]),
    new FormattableMarkup('Boost value for tag @tag must be numeric.', [
      '@tag' => '<h2>',
    ]),
    new FormattableMarkup('Boost value for tag @tag must be non-negative.', [
      '@tag' => '<h3>',
    ]),
  ];
  $this
    ->checkValidationError($configuration, 'html_filter', $errors);
  $configuration = $form_values = [
    'all_fields' => TRUE,
    'title' => FALSE,
    'alt' => FALSE,
    'tags' => [
      'h1' => 10,
    ],
  ];
  $form_values['tags'] = 'h1: 10';
  $this
    ->editSettingsForm($configuration, 'html_filter', $form_values);
}