Mercurial > hg > isophonics-drupal-site
diff core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
line wrap: on
line diff
--- a/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php Thu Apr 26 11:26:54 2018 +0100 +++ b/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php Tue Jul 10 15:07:59 2018 +0100 @@ -27,6 +27,13 @@ protected $revisionLogs; /** + * An arbitrary user for revision authoring. + * + * @var \Drupal\user\UserInterface + */ + protected $revisionUser; + + /** * {@inheritdoc} */ protected function setUp() { @@ -47,6 +54,10 @@ // Create an initial node. $node = $this->drupalCreateNode(); + // Create a user for revision authoring. + // This must be different from user performing revert. + $this->revisionUser = $this->drupalCreateUser(); + $settings = get_object_vars($node); $settings['revision'] = 1; @@ -86,6 +97,8 @@ 'format' => filter_default_format(), ]; $node->setNewRevision(); + // Ensure the revision author is a different user. + $node->setRevisionUserId($this->revisionUser->id()); $node->save(); return $node; @@ -141,6 +154,11 @@ $reverted_node = $node_storage->load($node->id()); $this->assertTrue(($nodes[1]->body->value == $reverted_node->body->value), 'Node reverted correctly.'); + // Confirm the revision author is the user performing the revert. + $this->assertTrue($reverted_node->getRevisionUserId() == $this->loggedInUser->id(), 'Node revision author is user performing revert.'); + // And that its not the revision author. + $this->assertTrue($reverted_node->getRevisionUserId() != $this->revisionUser->id(), 'Node revision author is not original revision author.'); + // Confirm that this is not the current version. $node = node_revision_load($node->getRevisionId()); $this->assertFalse($node->isDefaultRevision(), 'Third node revision is not the current one.');