// Confirm that this is the default revision.
$this->assertTrue($node->isDefaultRevision(), 'Third node revision is the default 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]->label()} 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($nodes[1]->getRevisionUserId(), $reverted_node->getRevisionUserId(), 'Node revision author is not original revision author.');