You are here

public function SearchApiSortsUpdate8102Test::testUpdate8102 in Search API sorts 8

Tests that all disabled sort configs are deleted from the active config.

See also

search_api_sorts_update_8102()

File

tests/src/Functional/Update/SearchApiSortsUpdate8102Test.php, line 25

Class

SearchApiSortsUpdate8102Test
Tests the Search api sorts upgrade path for update 8102.

Namespace

Drupal\Tests\search_api_sorts\Functional\Update

Code

public function testUpdate8102() {
  $this->container
    ->get('module_installer')
    ->install([
    'search_api_sorts_test_views',
  ]);

  // Assert that config files in the module install directory exist before
  // running updates.
  $this
    ->assertNotEmpty($this->container
    ->get('entity_type.manager')
    ->getStorage('search_api_sorts_field')
    ->load('views_page---search_api_sorts_test_view__page_1_type'));
  $this
    ->assertNotEmpty($this->container
    ->get('entity_type.manager')
    ->getStorage('search_api_sorts_field')
    ->load('views_page---search_api_sorts_test_view__page_1_title'));
  $this
    ->runUpdates();

  // Assert that only enabled sort configs exist after running updates.
  $this
    ->assertEmpty($this->container
    ->get('entity_type.manager')
    ->getStorage('search_api_sorts_field')
    ->load('views_page---search_api_sorts_test_view__page_1_type'));
  $this
    ->assertNotEmpty($this->container
    ->get('entity_type.manager')
    ->getStorage('search_api_sorts_field')
    ->load('views_page---search_api_sorts_test_view__page_1_title'));
}