Commit 2be39c73 authored by catch's avatar catch

Issue #2718583 by alexpott: Remove deprecated usages of...

Issue #2718583 by alexpott: Remove deprecated usages of Node::setRevisionAuthorId() and Node::getRevisionAuthor()
parent a39876b9
...@@ -182,7 +182,7 @@ public function revisionOverview(NodeInterface $node) { ...@@ -182,7 +182,7 @@ public function revisionOverview(NodeInterface $node) {
if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) { if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) {
$username = [ $username = [
'#theme' => 'username', '#theme' => 'username',
'#account' => $revision->getRevisionAuthor(), '#account' => $revision->getRevisionUser(),
]; ];
// Use revision link to link to revisions that are not active. // Use revision link to link to revisions that are not active.
......
...@@ -102,8 +102,8 @@ public function preSave(EntityStorageInterface $storage) { ...@@ -102,8 +102,8 @@ public function preSave(EntityStorageInterface $storage) {
// If no revision author has been set explicitly, make the node owner the // If no revision author has been set explicitly, make the node owner the
// revision author. // revision author.
if (!$this->getRevisionAuthor()) { if (!$this->getRevisionUser()) {
$this->setRevisionAuthorId($this->getOwnerId()); $this->setRevisionUserId($this->getOwnerId());
} }
} }
......
...@@ -322,7 +322,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { ...@@ -322,7 +322,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
$node->setNewRevision(); $node->setNewRevision();
// If a new revision is created, save the current user as revision author. // If a new revision is created, save the current user as revision author.
$node->setRevisionCreationTime(REQUEST_TIME); $node->setRevisionCreationTime(REQUEST_TIME);
$node->setRevisionAuthorId(\Drupal::currentUser()->id()); $node->setRevisionUserId(\Drupal::currentUser()->id());
} }
else { else {
$node->setNewRevision(FALSE); $node->setNewRevision(FALSE);
......
...@@ -30,14 +30,14 @@ public function testNodeRevision() { ...@@ -30,14 +30,14 @@ public function testNodeRevision() {
$this->assertIdentical('Test title rev 2', $node->getTitle()); $this->assertIdentical('Test title rev 2', $node->getTitle());
$this->assertIdentical('body test rev 2', $node->body->value); $this->assertIdentical('body test rev 2', $node->body->value);
$this->assertIdentical('teaser test rev 2', $node->body->summary); $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('modified rev 2', $node->revision_log->value);
$this->assertIdentical('1390095702', $node->getRevisionCreationTime()); $this->assertIdentical('1390095702', $node->getRevisionCreationTime());
$node = \Drupal::entityManager()->getStorage('node')->loadRevision(5); $node = \Drupal::entityManager()->getStorage('node')->loadRevision(5);
$this->assertIdentical('1', $node->id()); $this->assertIdentical('1', $node->id());
$this->assertIdentical('body test rev 3', $node->body->value); $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('modified rev 3', $node->revision_log->value);
$this->assertIdentical('1390095703', $node->getRevisionCreationTime()); $this->assertIdentical('1390095703', $node->getRevisionCreationTime());
} }
......
...@@ -112,7 +112,7 @@ public function testNodeEdit() { ...@@ -112,7 +112,7 @@ public function testNodeEdit() {
// made by different users. // made by different users.
$first_node_version = node_revision_load($node->getRevisionId()); $first_node_version = node_revision_load($node->getRevisionId());
$second_node_version = node_revision_load($revised_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 @@ protected function setUp() { ...@@ -104,10 +104,10 @@ protected function setUp() {
// Edit the 2nd revision with a different user. // Edit the 2nd revision with a different user.
if ($i == 1) { if ($i == 1) {
$editor = $this->drupalCreateUser(); $editor = $this->drupalCreateUser();
$node->setRevisionAuthorId($editor->id()); $node->setRevisionUserId($editor->id());
} }
else { else {
$node->setRevisionAuthorId($web_user->id()); $node->setRevisionUserId($web_user->id());
} }
$node->save(); $node->save();
......
...@@ -46,7 +46,7 @@ public function testNode() { ...@@ -46,7 +46,7 @@ public function testNode() {
/** @var \Drupal\node\NodeInterface $node_revision */ /** @var \Drupal\node\NodeInterface $node_revision */
$node_revision = \Drupal::entityManager()->getStorage('node')->loadRevision(1); $node_revision = \Drupal::entityManager()->getStorage('node')->loadRevision(1);
$this->assertIdentical('Test title', $node_revision->getTitle()); $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 is empty on the first revision.
$this->assertIdentical(NULL, $node_revision->revision_log->value); $this->assertIdentical(NULL, $node_revision->revision_log->value);
$this->assertIdentical('This is a shared text field', $node->field_test->value); $this->assertIdentical('This is a shared text field', $node->field_test->value);
......
...@@ -110,7 +110,7 @@ protected function assertRevision($id, $title, $uid, $log, $timestamp) { ...@@ -110,7 +110,7 @@ protected function assertRevision($id, $title, $uid, $log, $timestamp) {
$revision = \Drupal::entityManager()->getStorage('node')->loadRevision($id); $revision = \Drupal::entityManager()->getStorage('node')->loadRevision($id);
$this->assertTrue($revision instanceof NodeInterface); $this->assertTrue($revision instanceof NodeInterface);
$this->assertIdentical($title, $revision->getTitle()); $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($log, $revision->revision_log->value);
$this->assertIdentical($timestamp, $revision->getRevisionCreationTime()); $this->assertIdentical($timestamp, $revision->getRevisionCreationTime());
} }
......
...@@ -353,7 +353,7 @@ function testUserAnonymize() { ...@@ -353,7 +353,7 @@ function testUserAnonymize() {
$test_node = $node_storage->load($node->id()); $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.'); $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); $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())); $node_storage->resetCache(array($revision_node->id()));
$test_node = $node_storage->load($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."); $this->assertTrue(($test_node->getOwnerId() != 0 && $test_node->isPublished()), "Current revision of the user's node was not attributed to anonymous user.");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment