protected function SolrBackendTrait::enableSolrServer in Search API Solr 8.2
Same name and namespace in other branches
- 8.3 tests/src/Kernel/Processor/SolrBackendTrait.php \Drupal\Tests\search_api_solr\Kernel\Processor\SolrBackendTrait::enableSolrServer()
- 8 tests/src/Kernel/Processor/SolrBackendTrait.php \Drupal\Tests\search_api_solr\Kernel\Processor\SolrBackendTrait::enableSolrServer()
- 4.x 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.
Parameters
string $module: The module that provides the server config.
$config: The server config
6 calls to SolrBackendTrait::enableSolrServer()
- AddHierarchyTest::setUp in tests/
src/ Kernel/ Processor/ AddHierarchyTest.php - Performs setup tasks before each individual test method is run.
- ContentAccessTest::setUp in tests/
src/ Kernel/ Processor/ ContentAccessTest.php - Performs setup tasks before each individual test method is run.
- DateRangeTest::setUp in tests/
src/ Kernel/ Processor/ DateRangeTest.php - Performs setup tasks before each individual test method is run.
- DoubleQuoteWorkaroundTest::setUp in tests/
src/ Kernel/ Processor/ DoubleQuoteWorkaroundTest.php - Performs setup tasks before each individual test method is run.
- MultilingualAddHierarchyTest::setUp in tests/
src/ Kernel/ Processor/ MultilingualAddHierarchyTest.php - Performs setup tasks before each individual test method is run.
File
- tests/
src/ Kernel/ Processor/ SolrBackendTrait.php, line 26
Class
- SolrBackendTrait
- Helper to exchange the DB backend for a Solr backend in processor tests.
Namespace
Drupal\Tests\search_api_solr\Kernel\ProcessorCode
protected function enableSolrServer($module, $config) {
$this->server = Server::create(Yaml::parse(file_get_contents(drupal_get_path('module', $module) . $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());
}