diff --git a/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php b/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php index b18ad958c5b..7fec4acaec7 100644 --- a/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php +++ b/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php @@ -440,6 +440,19 @@ class ToolbarAdminMenuTest extends WebTestBase { $this->assertNotEqual($original_subtree_hash, $new_subtree_hash, 'The user-specific subtree menu hash has been updated.'); } + /** + * Tests that the 'toolbar/subtrees/{hash}' is reachable. + */ + function testSubtreesJsonRequest() { + $admin_user = $this->admin_user; + $this->drupalLogin($admin_user); + // Request a new page to refresh the drupalSettings object. + $subtrees_hash = $this->getSubtreesHash(); + + $this->drupalGetJSON('toolbar/subtrees/' . $subtrees_hash); + $this->assertResponse('200'); + } + /** * Get the hash value from the admin menu subtrees route path. * diff --git a/core/modules/toolbar/toolbar.routing.yml b/core/modules/toolbar/toolbar.routing.yml index 2e1e4cd5bd7..6e2f2559bb3 100644 --- a/core/modules/toolbar/toolbar.routing.yml +++ b/core/modules/toolbar/toolbar.routing.yml @@ -3,4 +3,4 @@ toolbar.subtrees: defaults: _controller: '\Drupal\toolbar\Controller\ToolbarController::subtreesJsonp' requirements: - _custom_access: '\Drupal\toolbar\Routing\ToolbarController::checkSubTreeAccess' + _custom_access: '\Drupal\toolbar\Controller\ToolbarController::checkSubTreeAccess'