You are here

public function ToolbarAdminMenuTest::testMenuLinkUpdateSubtreesHashCacheClear in Drupal 8

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