You are here

protected function SearchApiWebTest::disableModules in Search API 7

Tests whether disabling and uninstalling the modules works correctly.

This will disable and uninstall both the test module and the Search API. It asserts that this works correctly (since the server has been deleted in deleteServer()) and that all associated tables and variables are removed.

1 call to SearchApiWebTest::disableModules()
SearchApiWebTest::testFramework in ./search_api.test
Tests correct admin UI, indexing and search behavior.

File

./search_api.test, line 733
Contains the SearchApiWebTest and the SearchApiUnitTest classes.

Class

SearchApiWebTest
Class for testing Search API functionality via the UI.

Code

protected function disableModules() {
  module_disable(array(
    'search_api_test_2',
  ), FALSE);
  $this
    ->assertFalse(module_exists('search_api_test_2'), 'Second test module was successfully disabled.');
  module_disable(array(
    'search_api_test',
  ), FALSE);
  $this
    ->assertFalse(module_exists('search_api_test'), 'First test module was successfully disabled.');
  module_disable(array(
    'search_api',
  ), FALSE);
  $this
    ->assertFalse(module_exists('search_api'), 'Search API module was successfully disabled.');
  drupal_uninstall_modules(array(
    'search_api_test_2',
  ), FALSE);
  $this
    ->assertEqual(drupal_get_installed_schema_version('search_api_test_2', TRUE), SCHEMA_UNINSTALLED, 'Second test module was successfully uninstalled.');
  drupal_uninstall_modules(array(
    'search_api_test',
  ), FALSE);
  $this
    ->assertEqual(drupal_get_installed_schema_version('search_api_test', TRUE), SCHEMA_UNINSTALLED, 'First test module was successfully uninstalled.');
  $this
    ->assertFalse(db_table_exists('search_api_test'), 'Test module table was successfully removed.');
  drupal_uninstall_modules(array(
    'search_api',
  ), FALSE);
  $this
    ->assertEqual(drupal_get_installed_schema_version('search_api', TRUE), SCHEMA_UNINSTALLED, 'Search API module was successfully uninstalled.');
  $this
    ->assertFalse(db_table_exists('search_api_server'), 'Search server table was successfully removed.');
  $this
    ->assertFalse(db_table_exists('search_api_index'), 'Search index table was successfully removed.');
  $this
    ->assertFalse(db_table_exists('search_api_item'), 'Index items table was successfully removed.');
  $this
    ->assertFalse(db_table_exists('search_api_task'), 'Server tasks table was successfully removed.');
  $this
    ->assertNull(variable_get('search_api_index_worker_callback_runtime'), 'Worker runtime variable was correctly removed.');
}