Issue #2718583 by alexpott: Remove deprecated usages of Node::setRevisionAuthorId() and Node::getRevisionAuthor()
parent
a39876b9f4
commit
2be39c7387
|
@ -182,7 +182,7 @@ class NodeController extends ControllerBase implements ContainerInjectionInterfa
|
|||
if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) {
|
||||
$username = [
|
||||
'#theme' => 'username',
|
||||
'#account' => $revision->getRevisionAuthor(),
|
||||
'#account' => $revision->getRevisionUser(),
|
||||
];
|
||||
|
||||
// Use revision link to link to revisions that are not active.
|
||||
|
|
|
@ -102,8 +102,8 @@ class Node extends ContentEntityBase implements NodeInterface {
|
|||
|
||||
// If no revision author has been set explicitly, make the node owner the
|
||||
// revision author.
|
||||
if (!$this->getRevisionAuthor()) {
|
||||
$this->setRevisionAuthorId($this->getOwnerId());
|
||||
if (!$this->getRevisionUser()) {
|
||||
$this->setRevisionUserId($this->getOwnerId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -322,7 +322,7 @@ class NodeForm extends ContentEntityForm {
|
|||
$node->setNewRevision();
|
||||
// If a new revision is created, save the current user as revision author.
|
||||
$node->setRevisionCreationTime(REQUEST_TIME);
|
||||
$node->setRevisionAuthorId(\Drupal::currentUser()->id());
|
||||
$node->setRevisionUserId(\Drupal::currentUser()->id());
|
||||
}
|
||||
else {
|
||||
$node->setNewRevision(FALSE);
|
||||
|
|
|
@ -30,14 +30,14 @@ class MigrateNodeRevisionTest extends MigrateNodeTestBase {
|
|||
$this->assertIdentical('Test title rev 2', $node->getTitle());
|
||||
$this->assertIdentical('body test rev 2', $node->body->value);
|
||||
$this->assertIdentical('teaser test rev 2', $node->body->summary);
|
||||
$this->assertIdentical('2', $node->getRevisionAuthor()->id());
|
||||
$this->assertIdentical('2', $node->getRevisionUser()->id());
|
||||
$this->assertIdentical('modified rev 2', $node->revision_log->value);
|
||||
$this->assertIdentical('1390095702', $node->getRevisionCreationTime());
|
||||
|
||||
$node = \Drupal::entityManager()->getStorage('node')->loadRevision(5);
|
||||
$this->assertIdentical('1', $node->id());
|
||||
$this->assertIdentical('body test rev 3', $node->body->value);
|
||||
$this->assertIdentical('1', $node->getRevisionAuthor()->id());
|
||||
$this->assertIdentical('1', $node->getRevisionUser()->id());
|
||||
$this->assertIdentical('modified rev 3', $node->revision_log->value);
|
||||
$this->assertIdentical('1390095703', $node->getRevisionCreationTime());
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ class NodeEditFormTest extends NodeTestBase {
|
|||
// made by different users.
|
||||
$first_node_version = node_revision_load($node->getRevisionId());
|
||||
$second_node_version = node_revision_load($revised_node->getRevisionId());
|
||||
$this->assertNotIdentical($first_node_version->getRevisionAuthor()->id(), $second_node_version->getRevisionAuthor()->id(), 'Each revision has a distinct user.');
|
||||
$this->assertNotIdentical($first_node_version->getRevisionUser()->id(), $second_node_version->getRevisionUser()->id(), 'Each revision has a distinct user.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -104,10 +104,10 @@ class NodeRevisionsTest extends NodeTestBase {
|
|||
// Edit the 2nd revision with a different user.
|
||||
if ($i == 1) {
|
||||
$editor = $this->drupalCreateUser();
|
||||
$node->setRevisionAuthorId($editor->id());
|
||||
$node->setRevisionUserId($editor->id());
|
||||
}
|
||||
else {
|
||||
$node->setRevisionAuthorId($web_user->id());
|
||||
$node->setRevisionUserId($web_user->id());
|
||||
}
|
||||
|
||||
$node->save();
|
||||
|
|
|
@ -46,7 +46,7 @@ class MigrateNodeTest extends MigrateNodeTestBase {
|
|||
/** @var \Drupal\node\NodeInterface $node_revision */
|
||||
$node_revision = \Drupal::entityManager()->getStorage('node')->loadRevision(1);
|
||||
$this->assertIdentical('Test title', $node_revision->getTitle());
|
||||
$this->assertIdentical('1', $node_revision->getRevisionAuthor()->id(), 'Node revision has the correct user');
|
||||
$this->assertIdentical('1', $node_revision->getRevisionUser()->id(), 'Node revision has the correct user');
|
||||
// This is empty on the first revision.
|
||||
$this->assertIdentical(NULL, $node_revision->revision_log->value);
|
||||
$this->assertIdentical('This is a shared text field', $node->field_test->value);
|
||||
|
|
|
@ -110,7 +110,7 @@ class MigrateNodeTest extends MigrateDrupal7TestBase {
|
|||
$revision = \Drupal::entityManager()->getStorage('node')->loadRevision($id);
|
||||
$this->assertTrue($revision instanceof NodeInterface);
|
||||
$this->assertIdentical($title, $revision->getTitle());
|
||||
$this->assertIdentical($uid, $revision->getRevisionAuthor()->id());
|
||||
$this->assertIdentical($uid, $revision->getRevisionUser()->id());
|
||||
$this->assertIdentical($log, $revision->revision_log->value);
|
||||
$this->assertIdentical($timestamp, $revision->getRevisionCreationTime());
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ class UserCancelTest extends WebTestBase {
|
|||
$test_node = $node_storage->load($node->id());
|
||||
$this->assertTrue(($test_node->getOwnerId() == 0 && $test_node->isPublished()), 'Node of the user has been attributed to anonymous user.');
|
||||
$test_node = node_revision_load($revision, TRUE);
|
||||
$this->assertTrue(($test_node->getRevisionAuthor()->id() == 0 && $test_node->isPublished()), 'Node revision of the user has been attributed to anonymous user.');
|
||||
$this->assertTrue(($test_node->getRevisionUser()->id() == 0 && $test_node->isPublished()), 'Node revision of the user has been attributed to anonymous user.');
|
||||
$node_storage->resetCache(array($revision_node->id()));
|
||||
$test_node = $node_storage->load($revision_node->id());
|
||||
$this->assertTrue(($test_node->getOwnerId() != 0 && $test_node->isPublished()), "Current revision of the user's node was not attributed to anonymous user.");
|
||||
|
|
Loading…
Reference in New Issue