You are here

public function UninstallTest::testUninstall in Message Subscribe 8

Tests uninstalling the module.

File

tests/src/Functional/UninstallTest.php, line 23

Class

UninstallTest
Ensures the module can be uninstalled.

Namespace

Drupal\Tests\message_subscribe\Functional

Code

public function testUninstall() {
  $admin = $this
    ->createUser([], NULL, TRUE);
  $this
    ->drupalLogin($admin);

  // Verify settings page.
  $this
    ->drupalGet(Url::fromRoute('message_subscribe.admin_settings'));
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Uninstall module.
  $this
    ->drupalPostForm('admin/modules/uninstall', [
    'uninstall[message_subscribe]' => TRUE,
  ], t('Uninstall'));
  $this
    ->drupalPostForm(NULL, [], t('Uninstall'));

  // Validate Message Subscribe was uninstalled.
  $this
    ->assertSession()
    ->pageTextContains(t('The selected modules have been uninstalled.'));
  $this
    ->drupalGet(Url::fromRoute('message_subscribe.admin_settings'));
  $this
    ->assertSession()
    ->statusCodeEquals(404);
}