function ToolbarAdminMenuTest::testMenuLinkUpdateSubtreesHashCacheClear

Same name in other branches
  1. 9 core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php \Drupal\Tests\toolbar\Functional\ToolbarAdminMenuTest::testMenuLinkUpdateSubtreesHashCacheClear()
  2. 8.9.x core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php \Drupal\Tests\toolbar\Functional\ToolbarAdminMenuTest::testMenuLinkUpdateSubtreesHashCacheClear()
  3. 11.x core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php \Drupal\Tests\toolbar\Functional\ToolbarAdminMenuTest::testMenuLinkUpdateSubtreesHashCacheClear()

Tests toolbar cache tags implementation.

File

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

Class

ToolbarAdminMenuTest
Tests the caching of the admin menu subtree items.

Namespace

Drupal\Tests\toolbar\Functional

Code

public function testMenuLinkUpdateSubtreesHashCacheClear() : void {
    // The ID of (any) admin menu link.
    $admin_menu_link_id = 'system.admin_config_development';
    // Disable the link.
    $edit = [];
    $edit['enabled'] = FALSE;
    $this->drupalGet("admin/structure/menu/link/" . $admin_menu_link_id . "/edit");
    $this->submitForm($edit, 'Save');
    $this->assertSession()
        ->statusCodeEquals(200);
    $this->assertSession()
        ->pageTextContains('The menu link has been saved.');
    // Assert that the subtrees hash has been altered because the subtrees
    // structure changed.
    $this->assertDifferentHash();
}

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