diff --git a/core/modules/node/src/Tests/NodeRevisionsTest.php b/core/modules/node/src/Tests/NodeRevisionsTest.php index 2e31145..2fc45b8 100644 --- a/core/modules/node/src/Tests/NodeRevisionsTest.php +++ b/core/modules/node/src/Tests/NodeRevisionsTest.php @@ -13,6 +13,7 @@ use Drupal\language\Entity\ConfigurableLanguage; use Drupal\node\Entity\Node; use Drupal\node\NodeInterface; +use Drupal\user\Entity\User; /** * Create a node with revisions and test viewing, saving, reverting, and @@ -93,6 +94,16 @@ protected function setUp() { ); $node->untranslatable_string_field->value = $this->randomString(); $node->setNewRevision(); + + // Edit the 2nd revision with a different user. + if ($i == 1) { + $editor = $this->drupalCreateUser(); + $node->setRevisionAuthorId($editor->id()); + } + else { + $node->setRevisionAuthorId($web_user->id()); + } + $node->save(); $node = Node::load($node->id()); // Make sure we get revision information. @@ -123,6 +134,12 @@ function testRevisions() { foreach ($logs as $revision_log) { $this->assertText($revision_log, 'Revision log message found.'); } + // Original author, and editor names should appear on revisions overview. + /** @var \Drupal\user\UserInterface $web_user */ + $web_user = $nodes[0]->revision_uid->entity; + $this->assertText(t('by @name', ['@name' => $web_user->getAccountName()])); + $editor = $nodes[1]->revision_uid->entity; + $this->assertText(t('by @name', ['@name' => $editor->getAccountName()])); // Confirm that this is the default revision. $this->assertTrue($node->isDefaultRevision(), 'Third node revision is the default one.');