You are here

protected function SearchApiDbUpdate8102Test::setUp in Search API 8

Overrides WebTestBase::setUp() for update testing.

The main difference in this method is that rather than performing the installation via the installer, a database is loaded. Additional work is then needed to set various things such as the config directories and the container that would normally be done via the installer.

Overrides UpdatePathTestBase::setUp

File

modules/search_api_db/src/Tests/Update/SearchApiDbUpdate8102Test.php, line 23

Class

SearchApiDbUpdate8102Test
Tests whether search_api_db_update_8102() works correctly.

Namespace

Drupal\search_api_db\Tests\Update

Code

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

  // We need to manually set our entity types as "installed".
  $entity_type_ids = [
    'search_api_index',
    'search_api_server',
    'search_api_task',
  ];
  foreach ($entity_type_ids as $entity_type_id) {
    $entity_type = \Drupal::getContainer()
      ->get('entity_type.manager')
      ->getDefinition($entity_type_id);
    \Drupal::getContainer()
      ->get('entity_type.listener')
      ->onEntityTypeCreate($entity_type);
  }
}