You are here

public function ModerationStateTransitionsTest::testAccess in Workbench Moderation 8

Tests route access/permissions.

File

tests/src/Functional/ModerationStateTransitionsTest.php, line 15

Class

ModerationStateTransitionsTest
Tests moderation state transition config entity.

Namespace

Drupal\Tests\workbench_moderation\Functional

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
      ->assertSession()
      ->statusCodeEquals(403);
  }
  $this
    ->drupalLogin($this->adminUser);
  foreach ($paths as $path) {
    $this
      ->drupalGet($path);

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