You are here

public function StreamingExpressionTest::setUp in Search API Solr 8.3

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

Overrides KernelTestBase::setUp

File

tests/src/Kernel/StreamingExpressionTest.php, line 54

Class

StreamingExpressionTest
Provides tests for building streaming expressions.

Namespace

Drupal\Tests\search_api_solr\Kernel

Code

public function setUp() {
  parent::setUp();
  $this
    ->installSchema('search_api', [
    'search_api_item',
  ]);
  $this
    ->installSchema('user', [
    'users_data',
  ]);
  $this
    ->installEntitySchema('entity_test_mulrev_changed');
  $this
    ->installEntitySchema('search_api_task');
  $this
    ->installConfig([
    'search_api_test_example_content',
    'search_api',
    'search_api_solr',
    'search_api_solr_test',
  ]);
  $this->index = Index::load('solr_search_index');
  $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);
}