You are here

public function ModerationStateStatesTest::testAccess in Workbench Moderation 8.2

Tests route access/permissions.

File

src/Tests/ModerationStateStatesTest.php, line 15

Class

ModerationStateStatesTest
Tests moderation state config entity.

Namespace

Drupal\workbench_moderation\Tests

Code

public function testAccess() {
  $paths = [
    'admin/structure/workbench-moderation',
    'admin/structure/workbench-moderation/states',
    'admin/structure/workbench-moderation/states/add',
    'admin/structure/workbench-moderation/states/draft',
    'admin/structure/workbench-moderation/states/draft/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);
  }
}