You are here

public function PackageManagementTest::testUninstall in MongoDB 7

Test successful execution of hook_uninstall() with Mongodb disabled.

This cannot be checked by API calls, because the missing functions will still be loaded in PHP, hence the need to use the UI to trigger page reloads.

File

mongodb_watchdog/src/Tests/PackageManagementTest.php, line 59

Class

PackageManagementTest
Test package management hooks.

Namespace

Drupal\mongodb_watchdog\Tests

Code

public function testUninstall() {
  module_enable([
    static::DRIVER,
    static::MODULE,
  ]);
  $this
    ->pass('Successfully enabled driver and watchdog.module.');
  module_disable([
    static::MODULE,
    static::DRIVER,
  ]);
  $admin = $this
    ->drupalCreateUser([
    'administer modules',
  ]);
  $this
    ->drupalLogin($admin);
  $modules = [
    'uninstall[mongodb_watchdog]' => 1,
  ];
  $this
    ->drupalPost('admin/modules/uninstall', $modules, t('Uninstall'));
  $this
    ->assertResponse(200, 'Module uninstall form succeeded');
  $this
    ->drupalPost(NULL, [], t('Uninstall'));

  // Broken core : this should NOT be a 200, but actually is.

  /*
      $this->assertResponse(200, 'Module uninstall confirmation succeeded');
  */
  $this
    ->assertText(t('The selected modules have been uninstalled.'), 'Module uninstall confirmation succeeded.');
  $this
    ->pass('Successfully uninstalled watchdog module.');
}