You are here

public function HtmlFilterTest::testStringProcessing in Search API 8

Tests whether strings are correctly handled.

String field handling should be completely independent of configuration.

@dataProvider stringProcessingDataProvider

Parameters

array $config: The configuration to set on the processor.

File

tests/src/Unit/Processor/HtmlFilterTest.php, line 245

Class

HtmlFilterTest
Tests the "HTML filter" processor.

Namespace

Drupal\Tests\search_api\Unit\Processor

Code

public function testStringProcessing(array $config) {
  $this->processor
    ->setConfiguration($config);
  $passed_value = '<h2>Foo Bar <em>Baz</em></h2>

<p>Bla Bla Bla. <strong title="Foobar">Important:</strong> Bla.</p>
<img src="/foo.png" alt="Some picture" />
<span>This is hidden</span>';
  $expected_value = preg_replace('/\\s+/', ' ', strip_tags($passed_value));
  $type = 'string';
  $this
    ->invokeMethod('processFieldValue', [
    &$passed_value,
    $type,
  ]);
  $this
    ->assertEquals($expected_value, $passed_value);
}