You are here

protected function SearchApiSolrTest::checkModuleUninstall in Search API Solr 8

Same name and namespace in other branches
  1. 8.3 tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::checkModuleUninstall()
  2. 8.2 tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::checkModuleUninstall()
  3. 4.x tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::checkModuleUninstall()

Tests whether removing the configuration again works as it should.

Overrides BackendTestBase::checkModuleUninstall

File

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

Class

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

Namespace

Drupal\Tests\search_api_solr\Kernel

Code

protected function checkModuleUninstall() {

  // See whether clearing the server works.
  // Regression test for #2156151.

  /** @var \Drupal\search_api\ServerInterface $server */
  $server = Server::load($this->serverId);

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

  // 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);
  $query = $this
    ->buildSearch();
  $results = $query
    ->execute();
  $this
    ->assertEquals(0, $results
    ->getResultCount(), 'Clearing the server worked correctly.');
}