You are here

public function HelpTopicSearchTest::testUninstallSearch in Drupal 9

Tests uninstalling the search module.

File

core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php, line 269

Class

HelpTopicSearchTest
Verifies help topic search.

Namespace

Drupal\Tests\help_topics\Functional

Code

public function testUninstallSearch() {

  // Ensure we can uninstall search and use the help system without
  // breaking.
  $this
    ->drupalLogin($this->rootUser);
  $edit = [];
  $edit['uninstall[search]'] = TRUE;
  $this
    ->drupalGet('admin/modules/uninstall');
  $this
    ->submitForm($edit, 'Uninstall');
  $this
    ->submitForm([], 'Uninstall');
  $this
    ->assertSession()
    ->pageTextContains('The selected modules have been uninstalled.');
  $this
    ->drupalGet('admin/help');
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Rebuild the container to reflect the latest changes.
  $this
    ->rebuildContainer();
  $this
    ->assertTrue(\Drupal::moduleHandler()
    ->moduleExists('help_topics'), 'The help_topics module is still installed.');
  $this
    ->assertFalse(\Drupal::moduleHandler()
    ->moduleExists('search'), 'The search module is uninstalled.');
}