You are here

public function ToolbarAdminMenuTest::testModuleStatusChangeSubtreesHashCacheClear in Drupal 8

Same name and namespace 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()

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();
}