You are here

public function ToolbarAdminMenuTest::testMenuLinkUpdateSubtreesHashCacheClear 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::testMenuLinkUpdateSubtreesHashCacheClear()

Tests toolbar cache tags implementation.

File

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

Class

ToolbarAdminMenuTest
Tests the caching of the admin menu subtree items.

Namespace

Drupal\Tests\toolbar\Functional

Code

public function testMenuLinkUpdateSubtreesHashCacheClear() {

  // 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();
}