You are here

function ToolbarAdminMenuTest::testModuleStatusChangeSubtreesHashCacheClear in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php \Drupal\toolbar\Tests\ToolbarAdminMenuTest::testModuleStatusChangeSubtreesHashCacheClear()

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

File

core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php, line 105
Contains \Drupal\toolbar\Tests\ToolbarAdminMenuTest.

Class

ToolbarAdminMenuTest
Tests the caching of the admin menu subtree items.

Namespace

Drupal\toolbar\Tests

Code

function testModuleStatusChangeSubtreesHashCacheClear() {

  // Uninstall a module.
  $edit = array();
  $edit['uninstall[taxonomy]'] = TRUE;
  $this
    ->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));

  // Confirm the uninstall form.
  $this
    ->drupalPostForm(NULL, array(), t('Uninstall'));
  $this
    ->rebuildContainer();

  // Assert that the subtrees hash has been altered because the subtrees
  // structure changed.
  $this
    ->assertDifferentHash();

  // Enable a module.
  $edit = array();
  $edit['modules[Core][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();
}