You are here

private function ToolbarAdminMenuTest::assertDifferentHash in Zircon Profile 8.0

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

Asserts the subtrees hash on a fresh page GET is different from the hash from the previous page GET.

4 calls to ToolbarAdminMenuTest::assertDifferentHash()
ToolbarAdminMenuTest::testMenuLinkUpdateSubtreesHashCacheClear in core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php
Tests toolbar cache tags implementation.
ToolbarAdminMenuTest::testModuleStatusChangeSubtreesHashCacheClear in core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php
Tests the toolbar_modules_installed() and toolbar_modules_uninstalled() hook implementations.
ToolbarAdminMenuTest::testNonCurrentUserAccountUpdates in core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php
Tests that changes to a user account by another user clears the changed account's toolbar cached, not the user's who took the action.
ToolbarAdminMenuTest::testUserRoleUpdateSubtreesHashCacheClear in core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php
Exercises the toolbar_user_role_update() and toolbar_user_update() hook implementations.

File

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

Class

ToolbarAdminMenuTest
Tests the caching of the admin menu subtree items.

Namespace

Drupal\toolbar\Tests

Code

private function assertDifferentHash() {

  // Request a new page to refresh the drupalSettings object.
  $this
    ->drupalGet('test-page');
  $this
    ->assertResponse(200);
  $new_subtree_hash = $this
    ->getSubtreesHash();

  // Assert that the old admin menu subtree hash and the new admin menu
  // subtree hash are different.
  $this
    ->assertTrue($new_subtree_hash, 'A valid hash value for the admin menu subtrees was created.');
  $this
    ->assertNotEqual($this->hash, $new_subtree_hash, 'The user-specific subtree menu hash has been updated.');

  // Save the new subtree hash as the original.
  $this->hash = $new_subtree_hash;
}