You are here

protected function SearchApiSolrTest::clearIndex in Search API Solr 8

Clears the test index.

Overrides BackendTestBase::clearIndex

2 calls to SearchApiSolrTest::clearIndex()
SearchApiSolrTest::checkBackendSpecificFeatures in tests/src/Kernel/SearchApiSolrTest.php
Checks backend specific features.
SearchApiSolrTest::tearDown in tests/src/Kernel/SearchApiSolrTest.php
Clear the index after every test.

File

tests/src/Kernel/SearchApiSolrTest.php, line 167

Class

SearchApiSolrTest
Tests index and search capabilities using the Solr search backend.

Namespace

Drupal\Tests\search_api_solr\Kernel

Code

protected function clearIndex() {
  if ($this->solrAvailable) {

    /** @var \Drupal\search_api\IndexInterface $index */
    $index = Index::load($this->indexId);
    $index
      ->clear();

    // Deleting items take at least 1 second for Solr to parse it so that
    // drupal doesn't get timeouts while waiting for Solr. Lets give it 2
    // seconds to make sure we are in bounds.
    sleep(2);
  }
}