$this->
assertTrue($node->
isDefaultRevision(), 'Third node revision is the current one.'
);
// Confirm that revisions revert properly.
$this->
drupalGet("node/" .
$node->
id() . "/revisions/" .
$nodes[1
]->
getRevisionId() . "/revert"
);
$this->
submitForm([], 'Revert'
);
$this->
assertSession()->
pageTextContains("Basic page {
$nodes[1
]->
getTitle()} has been reverted to the revision from {
$this->container->
get('date.formatter'
)->
format($nodes[1
]->
getRevisionCreationTime())}."
);
$node_storage->
resetCache([$node->
id()]);
$reverted_node =
$node_storage->
load($node->
id());
$this->
assertSame($nodes[1
]->body->value,
$reverted_node->body->value, 'Node reverted correctly.'
);
// Confirm the revision author is the user performing the revert.
$this->
assertSame($this->loggedInUser->
id(),
$reverted_node->
getRevisionUserId(), 'Node revision author is user performing revert.'
);
// And that its not the revision author.
$this->
assertNotSame($this->revisionUser->
id(),
$reverted_node->
getRevisionUserId(), 'Node revision author is not original revision author.'
);
// Confirm that this is not the current version.
$node =
$node_storage->
loadRevision($node->
getRevisionId());
$this->
assertFalse($node->
isDefaultRevision(), 'Third node revision is not the current one.'
);
// Confirm that the node can still be updated.
$this->
drupalGet("node/" .
$reverted_node->
id() . "/edit"
);
$this->
submitForm(['body[0][value]' => 'We are Drupal.'
], 'Save'
);
$this->
assertSession()->
pageTextContains('Basic page ' .
$reverted_node->
getTitle() . ' has been updated.'
);