You are here

protected function QueryTest::setUp in Search API 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/System/QueryTest.php, line 45

Class

QueryTest
Tests query functionality.

Namespace

Drupal\Tests\search_api\Kernel\System

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installSchema('search_api', [
    'search_api_item',
  ]);
  $this
    ->installEntitySchema('entity_test_mulrev_changed');
  $this
    ->installEntitySchema('search_api_task');
  $this
    ->installConfig('search_api');

  // Create a test server.
  $server = Server::create([
    'name' => 'Test Server',
    'id' => 'test_server',
    'status' => 1,
    'backend' => 'search_api_test',
  ]);
  $server
    ->save();

  // Create a test index.
  Index::create([
    'name' => 'Test Index',
    'id' => 'test_index',
    'status' => 1,
    'datasource_settings' => [
      'search_api_test' => [],
    ],
    'processor_settings' => [
      'search_api_test' => [],
    ],
    'tracker_settings' => [
      'default' => [],
    ],
    'server' => $server
      ->id(),
    'options' => [
      'index_directly' => FALSE,
    ],
  ])
    ->save();
  $this->index = Index::load('test_index');
}