function HelpTopicSearchTest::testUninstallSearch

Same name and namespace in other branches
  1. 9 core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php \Drupal\Tests\help_topics\Functional\HelpTopicSearchTest::testUninstallSearch()
  2. 11.x core/modules/help/tests/src/Functional/HelpTopicSearchTest.php \Drupal\Tests\help\Functional\HelpTopicSearchTest::testUninstallSearch()

Tests uninstalling the search module.

File

core/modules/help/tests/src/Functional/HelpTopicSearchTest.php, line 278

Class

HelpTopicSearchTest
Verifies help topic search.

Namespace

Drupal\Tests\help\Functional

Code

public function testUninstallSearch() : void {
  // Ensure we can uninstall search and use the help system without
  // breaking.
  $this->drupalLogin($this->createUser([
    'administer modules',
    'access help pages',
  ]));
  $edit = [];
  $edit['uninstall[search]'] = TRUE;
  $this->drupalGet('admin/modules/uninstall');
  $this->submitForm($edit, 'Uninstall');
  $this->submitForm([], 'Uninstall');
  $this->assertSession()
    ->statusMessageContains('The selected modules have been uninstalled.', 'status');
  $this->drupalGet('admin/help');
  $this->assertSession()
    ->statusCodeEquals(200);
  // Rebuild the container to reflect the latest changes.
  $this->rebuildContainer();
  $this->assertTrue(\Drupal::moduleHandler()->moduleExists('help'), 'The help module is still installed.');
  $this->assertFalse(\Drupal::moduleHandler()->moduleExists('search'), 'The search module is uninstalled.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.