function NodeAccessTest::testGetDefaultRevisionId
Same name in other branches
- 9 core/modules/content_moderation/tests/src/Kernel/NodeAccessTest.php \Drupal\Tests\content_moderation\Kernel\NodeAccessTest::testGetDefaultRevisionId()
- 8.9.x core/modules/content_moderation/tests/src/Kernel/NodeAccessTest.php \Drupal\Tests\content_moderation\Kernel\NodeAccessTest::testGetDefaultRevisionId()
- 10 core/modules/content_moderation/tests/src/Kernel/NodeAccessTest.php \Drupal\Tests\content_moderation\Kernel\NodeAccessTest::testGetDefaultRevisionId()
@covers \Drupal\content_moderation\ModerationInformation::getDefaultRevisionId
File
-
core/
modules/ content_moderation/ tests/ src/ Kernel/ NodeAccessTest.php, line 72
Class
- NodeAccessTest
- Tests with node access enabled.
Namespace
Drupal\Tests\content_moderation\KernelCode
public function testGetDefaultRevisionId() : void {
// Create an admin user.
$user = $this->createUser([], NULL, TRUE);
\Drupal::currentUser()->setAccount($user);
// Create a node.
$node = $this->createNode([
'type' => 'page',
]);
$this->assertEquals($node->getRevisionId(), $this->moderationInformation
->getDefaultRevisionId('node', $node->id()));
// Create a non-admin user.
$user = $this->createUser();
\Drupal::currentUser()->setAccount($user);
$this->assertEquals($node->getRevisionId(), $this->moderationInformation
->getDefaultRevisionId('node', $node->id()));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.