You are here

protected function LanguageWithFallbackTest::getLanguageWithFallbackValues in Search API 8

Retrieves the indexed values.

Return value

array The indexed "language_with_fallback" field values for all indexed items, keyed by item ID.

1 call to LanguageWithFallbackTest::getLanguageWithFallbackValues()
LanguageWithFallbackTest::testIndexing in tests/src/Kernel/Processor/LanguageWithFallbackTest.php
Tests indexing.

File

tests/src/Kernel/Processor/LanguageWithFallbackTest.php, line 174

Class

LanguageWithFallbackTest
Tests the "Language (with fallback)" processor at a higher level.

Namespace

Drupal\Tests\search_api\Kernel\Processor

Code

protected function getLanguageWithFallbackValues() {
  $query = $this->index
    ->query();

  // We don't need a query condition as we have only one node anyway.
  $results = $query
    ->execute();
  $values = [];

  /** @var \Drupal\search_api\Item\ItemInterface $result */
  foreach ($results as $result) {
    $fieldValues = $result
      ->getField('language_with_fallback')
      ->getValues();
    sort($fieldValues);
    $values[$result
      ->getId()] = $fieldValues;
  }
  return $values;
}