protected function AutocompleteTest::assertSuggestionsEqual in Search API 8
Asserts that the returned suggestions are as expected.
Parameters
int[] $expected: Associative array mapping suggestion strings to their counts.
\Drupal\search_api_autocomplete\Suggestion\SuggestionInterface[] $suggestions: The suggestions returned by the backend.
1 call to AutocompleteTest::assertSuggestionsEqual()
- AutocompleteTest::testAutocompletion in modules/
search_api_db/ tests/ src/ Kernel/ AutocompleteTest.php - Tests whether autocomplete suggestions are correctly created.
File
- modules/
search_api_db/ tests/ src/ Kernel/ AutocompleteTest.php, line 130
Class
- AutocompleteTest
- Tests autocomplete functionality of the Database backend.
Namespace
Drupal\Tests\search_api_db\KernelCode
protected function assertSuggestionsEqual(array $expected, array $suggestions) {
$terms = [];
foreach ($suggestions as $suggestion) {
$terms[$suggestion
->getSuggestedKeys()] = $suggestion
->getResultsCount();
}
$this
->assertEquals($expected, $terms);
}