Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
7f4abc7c
Commit
7f4abc7c
authored
Mar 14, 2015
by
alexpott
Browse files
Issue
#2443119
by geertvd: Views preview not working for REST display
parent
02538138
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/modules/rest/src/Tests/Views/StyleSerializerTest.php
View file @
7f4abc7c
...
...
@@ -292,6 +292,19 @@ public function testLivePreview() {
$this
->
assertEqual
(
$rendered_json
,
$expected
,
'Ensure the previewed json is escaped.'
);
}
/**
* Tests the views interface for rest export displays.
*/
public
function
testSerializerViewsUI
()
{
$this
->
drupalLogin
(
$this
->
adminUser
);
// Click the "Update preview button".
$this
->
drupalPostForm
(
'admin/structure/views/view/test_serializer_display_field/edit/rest_export_1'
,
$edit
=
array
(),
t
(
'Update preview'
));
$this
->
assertResponse
(
200
);
// Check if we receive the expected result.
$result
=
$this
->
xpath
(
'//div[@id="views-live-preview"]/pre'
);
$this
->
assertIdentical
(
$this
->
drupalGet
(
'test/serialize/field'
),
(
string
)
$result
[
0
],
'The expected JSON preview output was found.'
);
}
/**
* Tests the field row style using fieldapi fields.
*/
...
...
core/modules/views/src/Plugin/views/display/PathPluginBase.php
View file @
7f4abc7c
...
...
@@ -502,7 +502,7 @@ public function getRouteName() {
// Check for overridden route names.
$view_route_names
=
$this
->
getAlteredRouteNames
();
return
(
isset
(
$view_route_names
[
$view_route_key
])
?
$view_route_names
[
$view_route_key
]
:
"view
s
.
$view_route_key
"
);
return
(
isset
(
$view_route_names
[
$view_route_key
])
?
$view_route_names
[
$view_route_key
]
:
"view.
$view_route_key
"
);
}
/**
...
...
core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php
View file @
7f4abc7c
...
...
@@ -311,6 +311,24 @@ public function testAlterRoutesWithOptionalParameters() {
$this
->
assertEquals
(
array
(
'arg_0'
=>
'parameter'
),
$route
->
getOption
(
'_view_argument_map'
));
}
/**
* Tests the getRouteName method.
*/
public
function
testGetRouteName
()
{
list
(
$view
)
=
$this
->
setupViewExecutableAccessPlugin
();
$display
=
array
();
$display
[
'display_plugin'
]
=
'page'
;
$display
[
'id'
]
=
'page_1'
;
$display
[
'display_options'
]
=
array
(
'path'
=>
'test_route'
,
);
$this
->
pathPlugin
->
initDisplay
(
$view
,
$display
);
$route_name
=
$this
->
pathPlugin
->
getRouteName
();
// Ensure that the expected routename is returned.
$this
->
assertEquals
(
'view.test_id.page_1'
,
$route_name
);
}
/**
* Returns some mocked view entity, view executable, and access plugin.
*/
...
...
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