You are here

protected function InstallUninstallTest::assertSuccessfulUninstall in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/src/Tests/Module/InstallUninstallTest.php \Drupal\system\Tests\Module\InstallUninstallTest::assertSuccessfulUninstall()

Uninstalls a module and asserts that it was done correctly.

Parameters

string $module: The name of the module to uninstall.

string $package: (optional) The package of the module to uninstall. Defaults to 'Core'.

1 call to InstallUninstallTest::assertSuccessfulUninstall()
InstallUninstallTest::testInstallUninstall in core/modules/system/src/Tests/Module/InstallUninstallTest.php
Tests that a fixed set of modules can be installed and uninstalled.

File

core/modules/system/src/Tests/Module/InstallUninstallTest.php, line 220
Contains \Drupal\system\Tests\Module\InstallUninstallTest.

Class

InstallUninstallTest
Install/uninstall core module and confirm table creation/deletion.

Namespace

Drupal\system\Tests\Module

Code

protected function assertSuccessfulUninstall($module, $package = 'Core') {
  $edit = array();
  $edit['uninstall[' . $module . ']'] = TRUE;
  $this
    ->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
  $this
    ->drupalPostForm(NULL, NULL, t('Uninstall'));
  $this
    ->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
  $this
    ->assertModules(array(
    $module,
  ), FALSE);

  // Check that the appropriate hook was fired and the appropriate log
  // message appears. (But don't check for the log message if the dblog
  // module was just uninstalled, since the {watchdog} table won't be there
  // anymore.)
  $this
    ->assertText(t('hook_modules_uninstalled fired for @module', array(
    '@module' => $module,
  )));
  $this
    ->assertLogMessage('system', "%module module uninstalled.", array(
    '%module' => $module,
  ), RfcLogLevel::INFO);

  // Check that the module's database tables no longer exist.
  $this
    ->assertModuleTablesDoNotExist($module);

  // Check that the module's config files no longer exist.
  $this
    ->assertNoModuleConfig($module);
  $this
    ->assertUninstallModuleUpdates($module);
}