You are here

public function ScheduledTransitionsPermissionsTest::testPermissions in Scheduled Transitions 8

Same name and namespace in other branches
  1. 2.x 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\Kernel

Code

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);
}