You are here

public function SocialDrupalContext::updateSearchIndexes in Open Social 8.9

Same name and namespace in other branches
  1. 8.5 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::updateSearchIndexes()
  2. 8.6 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::updateSearchIndexes()
  3. 8.7 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::updateSearchIndexes()
  4. 8.8 tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::updateSearchIndexes()
  5. 10.3.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::updateSearchIndexes()
  6. 10.0.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::updateSearchIndexes()
  7. 10.1.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::updateSearchIndexes()
  8. 10.2.x tests/behat/features/bootstrap/SocialDrupalContext.php \Drupal\social\Behat\SocialDrupalContext::updateSearchIndexes()

@Given Search indexes are up to date

File

tests/behat/features/bootstrap/SocialDrupalContext.php, line 158

Class

SocialDrupalContext
Provides pre-built step definitions for interacting with Open Social.

Namespace

Drupal\social\Behat

Code

public function updateSearchIndexes() {

  /** @var \Drupal\search_api\Entity\SearchApiConfigEntityStorage $index_storage */
  $index_storage = \Drupal::service("entity_type.manager")
    ->getStorage('search_api_index');
  $indexes = $index_storage
    ->loadMultiple();
  if (!$indexes) {
    return;
  }

  // Loop over all interfaces and let the Search API index any non-indexed
  // items.
  foreach ($indexes as $index) {

    /** @var \Drupal\search_api\IndexInterface $index */
    $index
      ->indexItems();
  }
}