Mercurial > hg > isophonics-drupal-site
comparison core/modules/node/src/Tests/NodeRevisionsTest.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
15:e200cb7efeb3 | 16:c2387f117808 |
---|---|
107 'format' => filter_default_format(), | 107 'format' => filter_default_format(), |
108 ]; | 108 ]; |
109 $node->untranslatable_string_field->value = $this->randomString(); | 109 $node->untranslatable_string_field->value = $this->randomString(); |
110 $node->setNewRevision(); | 110 $node->setNewRevision(); |
111 | 111 |
112 // Edit the 2nd revision with a different user. | 112 // Edit the 1st and 2nd revision with a different user. |
113 if ($i == 1) { | 113 if ($i < 2) { |
114 $editor = $this->drupalCreateUser(); | 114 $editor = $this->drupalCreateUser(); |
115 $node->setRevisionUserId($editor->id()); | 115 $node->setRevisionUserId($editor->id()); |
116 } | 116 } |
117 else { | 117 else { |
118 $node->setRevisionUserId($web_user->id()); | 118 $node->setRevisionUserId($web_user->id()); |
177 '%revision-date' => format_date($nodes[1]->getRevisionCreationTime()) | 177 '%revision-date' => format_date($nodes[1]->getRevisionCreationTime()) |
178 ]), 'Revision reverted.'); | 178 ]), 'Revision reverted.'); |
179 $node_storage->resetCache([$node->id()]); | 179 $node_storage->resetCache([$node->id()]); |
180 $reverted_node = $node_storage->load($node->id()); | 180 $reverted_node = $node_storage->load($node->id()); |
181 $this->assertTrue(($nodes[1]->body->value == $reverted_node->body->value), 'Node reverted correctly.'); | 181 $this->assertTrue(($nodes[1]->body->value == $reverted_node->body->value), 'Node reverted correctly.'); |
182 // Confirm the revision author is the user performing the revert. | |
183 $this->assertTrue($reverted_node->getRevisionUserId() == $this->loggedInUser->id(), 'Node revision author is user performing revert.'); | |
184 // And that its not the revision author. | |
185 $this->assertTrue($reverted_node->getRevisionUserId() != $nodes[1]->getRevisionUserId(), 'Node revision author is not original revision author.'); | |
182 | 186 |
183 // Confirm that this is not the default version. | 187 // Confirm that this is not the default version. |
184 $node = node_revision_load($node->getRevisionId()); | 188 $node = node_revision_load($node->getRevisionId()); |
185 $this->assertFalse($node->isDefaultRevision(), 'Third node revision is not the default one.'); | 189 $this->assertFalse($node->isDefaultRevision(), 'Third node revision is not the default one.'); |
186 | 190 |