You are here

public function ServerChangesTest::setUp in Search API 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/Server/ServerChangesTest.php, line 67

Class

ServerChangesTest
Tests whether changes for the server are processed correctly.

Namespace

Drupal\Tests\search_api\Kernel\Server

Code

public function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this
    ->installSchema('search_api', [
    'search_api_item',
  ]);
  $this
    ->installSchema('system', [
    'key_value_expire',
  ]);
  $this
    ->installEntitySchema('search_api_task');
  $this
    ->installConfig('search_api');

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

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

  // Reset the list of called backend methods.
  $this
    ->getCalledMethods('backend');
}