You are here

public function CliTest::setUp in Search API 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/System/CliTest.php, line 44

Class

CliTest
Tests Search API functionality when executed in the CLI.

Namespace

Drupal\Tests\search_api\Kernel\System

Code

public 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.
  $this->server = Server::create([
    'name' => 'Test server',
    'id' => 'test',
    'status' => 1,
    'backend' => 'search_api_test',
  ]);
  $this->server
    ->save();

  // Disable the use of batches for item tracking to simulate a CLI
  // environment.
  if (!Utility::isRunningInCli()) {
    \Drupal::state()
      ->set('search_api_use_tracking_batch', FALSE);
  }
}