You are here

public function ViewsTest::setUp in Search API Multilingual Solr Search 8

Overrides ViewsTest::setUp

File

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

Class

ViewsTest
Tests the Views integration of the Search API.

Namespace

Drupal\Tests\search_api_solr_multilingual\Functional

Code

public function setUp() {

  // Skip parent::setUp().
  SearchApiBrowserTestBase::setUp();

  // Add a second language.
  ConfigurableLanguage::createFromLangcode('nl')
    ->save();

  // Swap database backend for Solr backend.
  $config_factory = \Drupal::configFactory();
  $config_factory
    ->getEditable('search_api.index.database_search_index')
    ->delete();
  $config_factory
    ->rename('search_api.index.solr_multilingual_search_index', 'search_api.index.database_search_index');
  $config_factory
    ->getEditable('search_api.index.database_search_index')
    ->set('id', 'database_search_index')
    ->save();

  // Now do the same as parent::setUp().
  \Drupal::getContainer()
    ->get('search_api.index_task_manager')
    ->addItemsAll(Index::load($this->indexId));
  $this
    ->insertExampleContent();
  $this
    ->indexItems($this->indexId);
}