You are here

public function ViewsTest::setUp in Search API 8

Overrides SearchApiBrowserTestBase::setUp

File

tests/src/Functional/ViewsTest.php, line 49

Class

ViewsTest
Tests the Views integration of the Search API.

Namespace

Drupal\Tests\search_api\Functional

Code

public function setUp() {
  parent::setUp();

  // Add a second language.
  ConfigurableLanguage::createFromLangcode('nl')
    ->save();
  \Drupal::getContainer()
    ->get('search_api.index_task_manager')
    ->addItemsAll(Index::load($this->indexId));
  $this
    ->insertExampleContent();
  $this
    ->indexItems($this->indexId);

  // 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);
  }
}