You are here

public function BasicTrackerTest::setUp in Search API 8

Overrides KernelTestBase::setUp

File

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

Class

BasicTrackerTest
Tests the "default" tracker plugin.

Namespace

Drupal\Tests\search_api\Kernel

Code

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

  // Do not use a batch for tracking the initial items after creating an
  // index when running the tests via the GUI. Otherwise, it seems Drupal's
  // Batch API gets confused and the test fails.
  if (!Utility::isRunningInCli()) {
    \Drupal::state()
      ->set('search_api_use_tracking_batch', FALSE);
  }
  $this->index = Index::create([
    'id' => 'index',
    'tracker_settings' => [
      'default' => [],
    ],
  ]);
  $this->tracker = $this->index
    ->getTrackerInstance();
  $this->timeService = new TestTimeService();
  $this->tracker
    ->setTimeService($this->timeService);
}