You are here

public static function MethodOverrides::overrideTestBackendIndexItems in Search API 8

Provides an override for the test backend's indexItems() method.

Parameters

\Drupal\search_api\Backend\BackendInterface $backend: The backend plugin on which the method was called.

\Drupal\search_api\IndexInterface $index: The search index for which items should be indexed.

\Drupal\search_api\Item\ItemInterface[] $items: An array of items to be indexed, keyed by their item IDs.

Return value

string[] The array keys of $items.

File

tests/search_api_test/src/MethodOverrides.php, line 43

Class

MethodOverrides
Holds method overrides for test plugins.

Namespace

Drupal\search_api_test

Code

public static function overrideTestBackendIndexItems(BackendInterface $backend, IndexInterface $index, array $items) {
  if ($backend
    ->getConfiguration() !== [
    'test' => 'foobar',
  ]) {
    trigger_error('Server method indexItems() called with incorrect backend configuration.', E_USER_ERROR);
  }
  return array_keys($items);
}