You are here

public function ModerationStateTransitionsTest::testAccess in Workbench Moderation 8.2

Tests route access/permissions.

File

src/Tests/ModerationStateTransitionsTest.php, line 15

Class

ModerationStateTransitionsTest
Tests moderation state transition config entity.

Namespace

Drupal\workbench_moderation\Tests

Code

public function testAccess() {
  $paths = [
    'admin/structure/workbench-moderation/transitions',
    'admin/structure/workbench-moderation/transitions/add',
    'admin/structure/workbench-moderation/transitions/draft_needs_review',
    'admin/structure/workbench-moderation/transitions/draft_needs_review/delete',
  ];
  foreach ($paths as $path) {
    $this
      ->drupalGet($path);

    // No access.
    $this
      ->assertResponse(403);
  }
  $this
    ->drupalLogin($this->adminUser);
  foreach ($paths as $path) {
    $this
      ->drupalGet($path);

    // User has access.
    $this
      ->assertResponse(200);
  }
}