function ToolbarAdminMenuTest::testSubtreesJsonRequest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php \Drupal\toolbar\Tests\ToolbarAdminMenuTest::testSubtreesJsonRequest()
Tests that the 'toolbar/subtrees/{hash}' is reachable and correct.
File
- core/
modules/ toolbar/ src/ Tests/ ToolbarAdminMenuTest.php, line 332 - Contains \Drupal\toolbar\Tests\ToolbarAdminMenuTest.
Class
- ToolbarAdminMenuTest
- Tests the caching of the admin menu subtree items.
Namespace
Drupal\toolbar\TestsCode
function testSubtreesJsonRequest() {
$admin_user = $this->adminUser;
$this
->drupalLogin($admin_user);
// Request a new page to refresh the drupalSettings object.
$subtrees_hash = $this
->getSubtreesHash();
$ajax_result = $this
->drupalGetAjax('toolbar/subtrees/' . $subtrees_hash);
$this
->assertResponse('200');
$this
->assertEqual($ajax_result[0]['command'], 'setToolbarSubtrees', 'Subtrees response uses the correct command.');
$this
->assertEqual(array_keys($ajax_result[0]['subtrees']), [
'system-admin_content',
'system-admin_structure',
'system-themes_page',
'system-modules_list',
'system-admin_config',
'entity-user-collection',
'front',
], 'Correct subtrees returned.');
}