function ToolbarAdminMenuTest::testModuleStatusChangeSubtreesHashCacheClear
Same name in other branches
- 9 core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php \Drupal\Tests\toolbar\Functional\ToolbarAdminMenuTest::testModuleStatusChangeSubtreesHashCacheClear()
- 8.9.x core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php \Drupal\Tests\toolbar\Functional\ToolbarAdminMenuTest::testModuleStatusChangeSubtreesHashCacheClear()
- 10 core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php \Drupal\Tests\toolbar\Functional\ToolbarAdminMenuTest::testModuleStatusChangeSubtreesHashCacheClear()
Tests Toolbar's responses to installing and uninstalling modules.
See also
toolbar_modules_installed()
toolbar_modules_uninstalled()
File
-
core/
modules/ toolbar/ tests/ src/ Functional/ ToolbarAdminMenuTest.php, line 124
Class
- ToolbarAdminMenuTest
- Tests the caching of the admin menu subtree items.
Namespace
Drupal\Tests\toolbar\FunctionalCode
public function testModuleStatusChangeSubtreesHashCacheClear() : void {
// Use an admin role to ensure the user has all available permissions. This
// results in the admin menu links changing as the taxonomy module is
// installed and uninstalled because the role will always have the
// 'administer taxonomy' permission if it exists.
$role = Role::load($this->createRole([]));
$role->setIsAdmin(TRUE);
$role->save();
$this->adminUser
->addRole($role->id())
->save();
// Uninstall a module.
$edit = [];
$edit['uninstall[taxonomy]'] = TRUE;
$this->drupalGet('admin/modules/uninstall');
$this->submitForm($edit, 'Uninstall');
// Confirm the uninstall form.
$this->submitForm([], '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->drupalGet('admin/modules');
$this->submitForm($edit, '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.