$node->save();
- $node = Node::load($node->id()); // Make sure we get revision information.
+ // Make sure we get revision information.
+ $node = Node::load($node->id());
$nodes[] = clone $node;
}
$expected = '<li class="entitynodedelete-form"><a href="' . base_path() . 'node/' . $node->id() . '/delete">Delete</a></li>';
$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", [], t('Revert'));
- $this->assertRaw(t('@type %title has been reverted to the revision from %revision-date.',
- ['@type' => 'Basic page', '%title' => $nodes[1]->label(),
- '%revision-date' => format_date($nodes[1]->getRevisionCreationTime())]), 'Revision reverted.');
+ $this->assertRaw(t('@type %title has been reverted to the revision from %revision-date.', [
+ '@type' => 'Basic page',
+ '%title' => $nodes[1]->label(),
+ '%revision-date' => format_date($nodes[1]->getRevisionCreationTime())
+ ]), 'Revision reverted.');
$node_storage->resetCache([$node->id()]);
$reverted_node = $node_storage->load($node->id());
$this->assertTrue(($nodes[1]->body->value == $reverted_node->body->value), 'Node reverted correctly.');
$this->assertFalse(strstr($json[$ids[0]], '<li class="entitynodeedit-form">'), 'The "Edit" contextual link is not shown for a non-default revision.');
$this->assertFalse(strstr($json[$ids[0]], '<li class="entitynodedelete-form">'), 'The "Delete" contextual link is not shown for a non-default revision.');
-
// Confirm revisions delete properly.
$this->drupalPostForm("node/" . $node->id() . "/revisions/" . $nodes[1]->getRevisionId() . "/delete", [], t('Delete'));
- $this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.',
- ['%revision-date' => format_date($nodes[1]->getRevisionCreationTime()),
- '@type' => 'Basic page', '%title' => $nodes[1]->label()]), 'Revision deleted.');
+ $this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.', [
+ '%revision-date' => format_date($nodes[1]->getRevisionCreationTime()),
+ '@type' => 'Basic page',
+ '%title' => $nodes[1]->label(),
+ ]), 'Revision deleted.');
$this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid and vid = :vid', [':nid' => $node->id(), ':vid' => $nodes[1]->getRevisionId()])->fetchField() == 0, 'Revision not found.');
$this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_field_revision} WHERE nid = :nid and vid = :vid', [':nid' => $node->id(), ':vid' => $nodes[1]->getRevisionId()])->fetchField() == 0, 'Field revision not found.');