You are here

public function DoubleQuoteWorkaroundTest::setUp in Search API Solr 8.3

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/Processor/DoubleQuoteWorkaroundTest.php \Drupal\Tests\search_api_solr\Kernel\Processor\DoubleQuoteWorkaroundTest::setUp()
  2. 4.x tests/src/Kernel/Processor/DoubleQuoteWorkaroundTest.php \Drupal\Tests\search_api_solr\Kernel\Processor\DoubleQuoteWorkaroundTest::setUp()

Performs setup tasks before each individual test method is run.

Installs commonly used schemas and sets up a search server and an index, with the specified processor enabled.

Parameters

string|null $processor: (optional) The plugin ID of the processor that should be set up for testing.

Overrides ProcessorTestBase::setUp

File

tests/src/Kernel/Processor/DoubleQuoteWorkaroundTest.php, line 38

Class

DoubleQuoteWorkaroundTest
Tests the "Double Quote Workaround" processor.

Namespace

Drupal\Tests\search_api_solr\Kernel\Processor

Code

public function setUp($processor = NULL) {
  parent::setUp('double_quote_workaround');
  $this
    ->enableSolrServer();
  $backend = $this->index
    ->getServerInstance()
    ->getBackend();
  $config = $backend
    ->getConfiguration();

  // Streaming expressions are only supported by Solr Cloud.
  $config['connector'] = 'solr_cloud';
  $backend
    ->setConfiguration($config);
  $this->queryHelper = \Drupal::getContainer()
    ->get('search_api_solr.streaming_expression_query_helper');
  $this->query = $this->queryHelper
    ->createQuery($this->index);
  $this->exp = $this->queryHelper
    ->getStreamingExpressionBuilder($this->query);
}