public function ApidocEntityRevisionsAccessTest::testApiDocRevisionsAccessPermissions in Apigee API Catalog 8
Test ApiDocs revision access as a logged in user with some permissions.
File
- tests/
src/ Kernel/ ApidocEntityRevisionsAccessTest.php, line 159
Class
- ApidocEntityRevisionsAccessTest
- Tests the ApiDoc entity access permissions.
Namespace
Drupal\Tests\apigee_api_catalog\KernelCode
public function testApiDocRevisionsAccessPermissions() {
$user = $this
->createUser([
'view published apidoc entities',
'view unpublished apidoc entities',
'view apidoc revisions',
'edit apidoc entities',
'revert apidoc revisions',
]);
$this->container
->get('account_switcher')
->switchTo($user);
$entity_v1 = $this->entityTypeStorage
->loadRevision($this->apidocV1Id);
$tests = [
'view' => 'User should be able to view an unpublished revision.',
'update' => 'User should be able to update a revision.',
];
foreach ($tests as $op => $message) {
$this
->assertTrue($entity_v1
->access($op, $user), $message);
}
}