diff --git a/core/modules/node/src/Tests/NodeRevisionsTest.php b/core/modules/node/src/Tests/NodeRevisionsTest.php
index 5870606..521c14d 100644
--- a/core/modules/node/src/Tests/NodeRevisionsTest.php
+++ b/core/modules/node/src/Tests/NodeRevisionsTest.php
@@ -159,14 +159,13 @@ function testRevisions() {
// Confirm that the "Edit" and "Delete" contextual links appear for the
// default revision.
$ids = array('node:node=' . $node->id() . ':changed=' . $node->getChangedTime());
- $response = $this->renderContextualLinks($ids, "node/" . $node->id());
- $json = Json::decode($response);
+ $json = $this->renderContextualLinks($ids, "node/" . $node->id());
$this->verbose($json[$ids[0]]);
- $this->assertTrue(strstr($json[$ids[0]], '
Edit'),
- 'The "Edit" contextual link is shown for the default revision.');
- $this->assertTrue(strstr($json[$ids[0]], 'Delete'),
- 'The "Delete" contextual link is shown for the default revision.');
+ $expected = 'Edit';
+ $this->assertTrue(strstr($json[$ids[0]], $expected), 'The "Edit" contextual link is shown for the default revision.');
+ $expected = 'Delete');
+ $this->assertTrue(strstr($json[$ids[0]], $expected), 'The "Delete" contextual link is shown for the default revision.');
// Confirm that revisions revert properly.
$this->drupalPostForm("node/" . $node->id() . "/revisions/" . $nodes[1]->getRevisionid() . "/revert", array(), t('Revert'));
@@ -184,8 +183,7 @@ function testRevisions() {
// Confirm that "Edit" and "Delete" contextual links don't appear for
// non-default revision.
$ids = array('node_revision::node=' . $node->id() . '&node_revision=' . $node->getRevisionId() . ':');
- $response = $this->renderContextualLinks($ids, "node/" . $node->id() . '/revisions/' . $node->getRevisionId() . '/view');
- $json = Json::decode($response);
+ $json = $this->renderContextualLinks($ids, "node/" . $node->id() . '/revisions/' . $node->getRevisionId() . '/view');
$this->verbose($json[$ids[0]]);
$this->assertFalse(strstr($json[$ids[0]], ''),
@@ -300,14 +298,16 @@ function testNodeRevisionWithoutLogMessage() {
* The Drupal path for the page for which the contextual links are rendered.
*
* @return string
- * The response body.
+ * The decoded Json response body.
*/
protected function renderContextualLinks($ids, $current_path) {
$post = array();
for ($i = 0; $i < count($ids); $i++) {
$post['ids[' . $i . ']'] = $ids[$i];
}
- return $this->drupalPost('contextual/render', 'application/json', $post, array('query' => array('destination' => $current_path)));
+ $response = $this->drupalPost('contextual/render', 'application/json', $post, array('query' => array('destination' => $current_path)));
+
+ return Json::decode($response);
}
/**