public function ModerationStateStatesTest::testAccess in Workbench Moderation 8
Tests route access/permissions.
File
- tests/
src/ Functional/ ModerationStateStatesTest.php, line 15
Class
- ModerationStateStatesTest
- Tests moderation state config entity.
Namespace
Drupal\Tests\workbench_moderation\FunctionalCode
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
->assertSession()
->statusCodeEquals(403);
}
$this
->drupalLogin($this->adminUser);
foreach ($paths as $path) {
$this
->drupalGet($path);
// User has access.
$this
->assertSession()
->statusCodeEquals(200);
}
}