function ToolbarAdminMenuTest::assertDifferentHash

Same name and namespace in other branches
  1. 9 core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php \Drupal\Tests\toolbar\Functional\ToolbarAdminMenuTest::assertDifferentHash()
  2. 10 core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php \Drupal\Tests\toolbar\Functional\ToolbarAdminMenuTest::assertDifferentHash()
  3. 11.x 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 433

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.