function ToolbarAdminMenuTest::testModuleStatusChangeSubtreesHashCacheClear

Same name in other branches
  1. 9 core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php \Drupal\Tests\toolbar\Functional\ToolbarAdminMenuTest::testModuleStatusChangeSubtreesHashCacheClear()
  2. 10 core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php \Drupal\Tests\toolbar\Functional\ToolbarAdminMenuTest::testModuleStatusChangeSubtreesHashCacheClear()
  3. 11.x core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php \Drupal\Tests\toolbar\Functional\ToolbarAdminMenuTest::testModuleStatusChangeSubtreesHashCacheClear()

Tests the toolbar_modules_installed() and toolbar_modules_uninstalled() hook implementations.

File

core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php, line 116

Class

ToolbarAdminMenuTest
Tests the caching of the admin menu subtree items.

Namespace

Drupal\Tests\toolbar\Functional

Code

public function testModuleStatusChangeSubtreesHashCacheClear() {
    // Uninstall a module.
    $edit = [];
    $edit['uninstall[taxonomy]'] = TRUE;
    $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
    // Confirm the uninstall form.
    $this->drupalPostForm(NULL, [], t('Uninstall'));
    $this->rebuildContainer();
    // Assert that the subtrees hash has been altered because the subtrees
    // structure changed.
    $this->assertDifferentHash();
    // Enable a module.
    $edit = [];
    $edit['modules[taxonomy][enable]'] = TRUE;
    $this->drupalPostForm('admin/modules', $edit, t('Install'));
    $this->rebuildContainer();
    // Assert that the subtrees hash has been altered because the subtrees
    // structure changed.
    $this->assertDifferentHash();
}

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