public function NodeLegacyTest::testNodeGetRevisionAuthor in Drupal 8
Tests that Node::getRevisionAuthor() triggers a deprecation error.
@expectedDeprecation Drupal\node\Entity\Node::getRevisionAuthor is deprecated in drupal:8.2.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Entity\RevisionLogInterface::getRevisionUser() instead. See https://www.drupal.org/node/3069750
File
- core/
modules/ node/ tests/ src/ Kernel/ NodeLegacyTest.php, line 109
Class
- NodeLegacyTest
- Tests legacy user functionality.
Namespace
Drupal\Tests\node\KernelCode
public function testNodeGetRevisionAuthor() {
$user = $this
->createUser([
'uid' => 2,
'name' => 'Test',
]);
$entity = Node::create([
'type' => 'page',
]);
$entity
->setRevisionUser($user);
$this
->assertSame($user
->id(), $entity
->getRevisionAuthor()
->id());
}