You are here

private function ToolbarAdminMenuTest::assertDifferentHash in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php \Drupal\Tests\toolbar\Functional\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/tests/src/Functional/ToolbarAdminMenuTest.php
Tests toolbar cache tags implementation.
ToolbarAdminMenuTest::testModuleStatusChangeSubtreesHashCacheClear in core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php
Tests the toolbar_modules_installed() and toolbar_modules_uninstalled() hook implementations.
ToolbarAdminMenuTest::testNonCurrentUserAccountUpdates in core/modules/toolbar/tests/src/Functional/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/tests/src/Functional/ToolbarAdminMenuTest.php
Exercises the toolbar_user_role_update() and toolbar_user_update() hook implementations.

File

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

Class

ToolbarAdminMenuTest
Tests the caching of the admin menu subtree items.

Namespace

Drupal\Tests\toolbar\Functional

Code

private function assertDifferentHash() {

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

  // Assert that the old admin menu subtree hash and the new admin menu
  // subtree hash are different.
  $this
    ->assertNotEmpty($new_subtree_hash, 'A valid hash value for the admin menu subtrees was created.');
  $this
    ->assertNotEquals($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;
}