You are here

public function NodeLegacyTest::testNodeSetRevisionAuthorId in Drupal 8

Tests that Node::setRevisionAuthorId() triggers a deprecation error.

@expectedDeprecation Drupal\node\Entity\Node::setRevisionAuthorId is deprecated in drupal:8.2.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\RevisionLogInterface::setRevisionUserId() instead. See https://www.drupal.org/node/3069750

File

core/modules/node/tests/src/Kernel/NodeLegacyTest.php, line 95

Class

NodeLegacyTest
Tests legacy user functionality.

Namespace

Drupal\Tests\node\Kernel

Code

public function testNodeSetRevisionAuthorId() {
  $user = $this
    ->createUser([
    'uid' => 2,
    'name' => 'Test',
  ]);
  $entity = Node::create([
    'type' => 'page',
  ]);
  $entity
    ->setRevisionAuthorId($user
    ->id());
  $this
    ->assertSame($user
    ->id(), $entity
    ->getRevisionUser()
    ->id());
}