public function ScheduledTransitionsPermissionsTest::testPermissions in Scheduled Transitions 2.x
Same name and namespace in other branches
- 8 tests/src/Kernel/ScheduledTransitionsPermissionsTest.php \Drupal\Tests\scheduled_transitions\Kernel\ScheduledTransitionsPermissionsTest::testPermissions()
Tests dynamic permissions.
@covers ::permissions
File
- tests/
src/ Kernel/ ScheduledTransitionsPermissionsTest.php, line 49
Class
- ScheduledTransitionsPermissionsTest
- Tests scheduled transactions dynamic permissions.
Namespace
Drupal\Tests\scheduled_transitions\KernelCode
public function testPermissions() : void {
$this
->enabledBundles([
[
'entity_test_revlog',
'entity_test_revlog',
],
]);
$workflow = $this
->createEditorialWorkflow();
$workflow
->getTypePlugin()
->addEntityTypeAndBundle('entity_test_revlog', 'entity_test_revlog');
$workflow
->save();
/** @var \Drupal\user\PermissionHandlerInterface $permissionHandler */
$permissionHandler = \Drupal::service('user.permissions');
$permissions = $permissionHandler
->getPermissions();
$this
->assertArrayHasKey('view scheduled transitions entity_test_revlog entity_test_revlog', $permissions);
$this
->assertArrayHasKey('add scheduled transitions entity_test_revlog entity_test_revlog', $permissions);
}