You are here

protected function LinkitAutocompleteTest::getAutocompleteResult in Linkit 8.5

Returns the result of an Linkit autocomplete request.

Parameters

string $input: The label of the entity to query by.

Return value

array An array of suggestions.

6 calls to LinkitAutocompleteTest::getAutocompleteResult()
LinkitAutocompleteTest::testAutocompletion in tests/src/Kernel/LinkitAutocompleteTest.php
Tests autocompletion in general.
LinkitAutocompleteTest::testAutocompletionAccess in tests/src/Kernel/LinkitAutocompleteTest.php
Tests that inaccessible entities isn't included in the results.
LinkitAutocompleteTest::testAutocompletionEmail in tests/src/Kernel/LinkitAutocompleteTest.php
Tests the autocomplete with an email address.
LinkitAutocompleteTest::testAutocompletionFront in tests/src/Kernel/LinkitAutocompleteTest.php
Tests that 'front' adds the front page match.
LinkitAutocompleteTest::testAutocompletionTranslations in tests/src/Kernel/LinkitAutocompleteTest.php
Tests autocompletion with translated entities.

... See full list

File

tests/src/Kernel/LinkitAutocompleteTest.php, line 218

Class

LinkitAutocompleteTest
Tests the linkit autocomplete functionality.

Namespace

Drupal\Tests\linkit\Kernel

Code

protected function getAutocompleteResult($input) {
  $request = Request::create('linkit/autocomplete/' . $this->linkitProfile
    ->id());
  $request->query
    ->set('q', $input);
  $controller = AutocompleteController::create($this->container);
  $result = Json::decode($controller
    ->autocomplete($request, $this->linkitProfile
    ->id())
    ->getContent());
  return $result['suggestions'];
}