You are here

public function TaskTest::setUp in Search API 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/System/TaskTest.php, line 63

Class

TaskTest
Tests whether the Search API task system works correctly.

Namespace

Drupal\Tests\search_api\Kernel\System

Code

public function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('search_api_task');
  $this->taskManager = $this->container
    ->get('search_api.task_manager');
  $this->taskWorker = $this->container
    ->get('search_api_test_tasks.test_task_worker');

  // 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' => 0,
    'datasource_settings' => [
      'entity:user' => [],
    ],
    'tracker_settings' => [
      'default' => [],
    ],
  ]);
  $this->index
    ->save();
}