Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
220
Merge Requests
220
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
0feb1b69
Commit
0feb1b69
authored
Jul 17, 2015
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2534830
by Wim Leers: Toolbar subtrees not working
parent
7fb23ea2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
core/modules/toolbar/src/Controller/ToolbarController.php
core/modules/toolbar/src/Controller/ToolbarController.php
+1
-1
core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php
core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php
+8
-1
No files found.
core/modules/toolbar/src/Controller/ToolbarController.php
View file @
0feb1b69
...
...
@@ -22,7 +22,7 @@ class ToolbarController extends ControllerBase {
* @return \Symfony\Component\HttpFoundation\JsonResponse
*/
public
function
subtreesJsonp
()
{
$subtrees
=
toolbar_get_rendered_subtrees
();
list
(
$subtrees
,
$cacheability
)
=
toolbar_get_rendered_subtrees
();
$response
=
new
JsonResponse
(
$subtrees
);
$response
->
setCallback
(
'Drupal.toolbar.setSubtrees.resolve'
);
...
...
core/modules/toolbar/src/Tests/ToolbarAdminMenuTest.php
View file @
0feb1b69
...
...
@@ -7,6 +7,7 @@
namespace
Drupal\toolbar\Tests
;
use
Drupal\Component\Serialization\Json
;
use
Drupal\Core\Cache\Cache
;
use
Drupal\Core\Language\LanguageInterface
;
use
Drupal\language\Entity\ConfigurableLanguage
;
...
...
@@ -331,7 +332,7 @@ function testLocaleTranslationSubtreesHashCacheClear() {
}
/**
* Tests that the 'toolbar/subtrees/{hash}' is reachable.
* Tests that the 'toolbar/subtrees/{hash}' is reachable
and correct
.
*/
function
testSubtreesJsonRequest
()
{
$admin_user
=
$this
->
adminUser
;
...
...
@@ -341,6 +342,12 @@ function testSubtreesJsonRequest() {
$this
->
drupalGetJSON
(
'toolbar/subtrees/'
.
$subtrees_hash
);
$this
->
assertResponse
(
'200'
);
$json_callback_start
=
substr
(
$this
->
getRawContent
(),
0
,
39
);
$json_callback_end
=
substr
(
$this
->
getRawContent
(),
-
2
,
2
);
$json
=
substr
(
$this
->
getRawContent
(),
39
,
strlen
(
$this
->
getRawContent
())
-
41
);
$this
->
assertTrue
(
$json_callback_start
===
'/**/Drupal.toolbar.setSubtrees.resolve('
&&
$json_callback_end
===
');'
,
'Subtrees response is wrapped in callback.'
);
$subtrees
=
Json
::
decode
(
$json
);
$this
->
assertEqual
(
array_keys
(
$subtrees
),
[
'system-admin_content'
,
'system-admin_structure'
,
'system-themes_page'
,
'system-modules_list'
,
'system-admin_config'
,
'entity-user-collection'
,
'front'
],
'Correct subtrees JSON returned.'
);
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment