function ToolbarAdminMenuTest::testMenuLinkUpdateSubtreesHashCacheClear

Tests toolbar cache tags implementation.

File

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

Class

ToolbarAdminMenuTest
Tests the caching of the admin menu subtree items.

Namespace

Drupal\Tests\toolbar\Functional

Code

public function testMenuLinkUpdateSubtreesHashCacheClear() {
  // The ID of a (any) admin menu link.
  $admin_menu_link_id = 'system.admin_config_development';
  // Disable the link.
  $edit = [];
  $edit['enabled'] = FALSE;
  $this->drupalPostForm("admin/structure/menu/link/" . $admin_menu_link_id . "/edit", $edit, t('Save'));
  $this->assertSession()
    ->statusCodeEquals(200);
  $this->assertText('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.