You are here

protected function SolrBackendTrait::enableSolrServer in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 tests/src/Kernel/Processor/SolrBackendTrait.php \Drupal\Tests\search_api_solr\Kernel\Processor\SolrBackendTrait::enableSolrServer()
  2. 8 tests/src/Kernel/Processor/SolrBackendTrait.php \Drupal\Tests\search_api_solr\Kernel\Processor\SolrBackendTrait::enableSolrServer()
  3. 8.2 tests/src/Kernel/Processor/SolrBackendTrait.php \Drupal\Tests\search_api_solr\Kernel\Processor\SolrBackendTrait::enableSolrServer()

Swap the DB backend for a Solr backend.

This function has to be called from the test setUp() function.

10 calls to SolrBackendTrait::enableSolrServer()
AddHierarchyTest::enableSolrServer in modules/search_api_solr_legacy/tests/src/Kernel/Processor/AddHierarchyTest.php
Swap the DB backend for a Solr backend.
AddHierarchyTest::setUp in tests/src/Kernel/Processor/AddHierarchyTest.php
BoostMoreRecentTest::setUp in tests/src/Kernel/Processor/BoostMoreRecentTest.php
ContentAccessTest::enableSolrServer in modules/search_api_solr_legacy/tests/src/Kernel/Processor/ContentAccessTest.php
Swap the DB backend for a Solr backend.
ContentAccessTest::setUp in tests/src/Kernel/Processor/ContentAccessTest.php

... See full list

3 methods override SolrBackendTrait::enableSolrServer()
AddHierarchyTest::enableSolrServer in modules/search_api_solr_legacy/tests/src/Kernel/Processor/AddHierarchyTest.php
Swap the DB backend for a Solr backend.
ContentAccessTest::enableSolrServer in modules/search_api_solr_legacy/tests/src/Kernel/Processor/ContentAccessTest.php
Swap the DB backend for a Solr backend.
HtmlFilterTest::enableSolrServer in modules/search_api_solr_legacy/tests/src/Kernel/Processor/HtmlFilterTest.php
Swap the DB backend for a Solr backend.

File

tests/src/Kernel/Processor/SolrBackendTrait.php, line 25

Class

SolrBackendTrait
Helper to exchange the DB backend for a Solr backend in processor tests.

Namespace

Drupal\Tests\search_api_solr\Kernel\Processor

Code

protected function enableSolrServer() {
  $config = '/config/install/search_api.server.solr_search_server' . ('true' === SOLR_CLOUD ? '_cloud' : '') . '.yml';
  $this->server = Server::create(Yaml::parse(file_get_contents(drupal_get_path('module', 'search_api_solr_test') . $config)));
  $this->server
    ->save();
  $this->index
    ->setServer($this->server);
  $this->index
    ->save();
  $index_storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('search_api_index');
  $index_storage
    ->resetCache([
    $this->index
      ->id(),
  ]);
  $this->index = $index_storage
    ->load($this->index
    ->id());
}