You are here

public function IndexImportTest::setUp in Search API 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/Index/IndexImportTest.php, line 42

Class

IndexImportTest
Tests whether importing of index configuration works correctly.

Namespace

Drupal\Tests\search_api\Kernel\Index

Code

public function setUp() {
  parent::setUp();
  $this
    ->installSchema('search_api', [
    'search_api_item',
  ]);
  $this
    ->installSchema('user', [
    'users_data',
  ]);
  $this
    ->installEntitySchema('entity_test_mulrev_changed');
  $this
    ->installEntitySchema('search_api_task');
  $this
    ->installConfig('search_api');
  $this
    ->installConfig('system');
  $this
    ->config('system.site')
    ->set('UUID', $this->container
    ->get('uuid')
    ->generate());

  // 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
    ->installConfig([
    'search_api_test_db',
  ]);
  $this->storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('search_api_index');
}