public function HighlightTest::testRegressionBug3022724 in Search API 8
Provides a regression test for bug #3022724.
Before the bug was fixed, certain combinations of text field values and keywords could lead to an infinite loop, or at least to the excerpt only containing the first snippet.
@dataProvider regressionBug3022724DataProvider
Parameters
string $text: The input text.
string[] $keys: The keys that should be highlighted.
string $expected: The expected result containing the highlighted strings.
See also
https://www.drupal.org/node/3022724
File
- tests/
src/ Unit/ Processor/ HighlightTest.php, line 1080
Class
- HighlightTest
- Tests the "Highlight" processor.
Namespace
Drupal\Tests\search_api\Unit\ProcessorCode
public function testRegressionBug3022724($text, array $keys, $expected) {
$method = new \ReflectionMethod($this->processor, 'createExcerpt');
$method
->setAccessible(TRUE);
$excerpt = $method
->invoke($this->processor, $text, $keys);
$this
->assertEquals($expected, $excerpt);
}