You are here

public function ChecklistapiWebTestCase::testAccessChecklist in Checklist API 7

Test checklist access.

File

tests/checklistapi.test, line 98
Tests for Checklist API module.

Class

ChecklistapiWebTestCase
Functional tests for Checklist API.

Code

public function testAccessChecklist() {
  $this
    ->drupalGet('admin/config/development/checklistapi-example');
  $this
    ->assertResponse(200, 'Granted access to user with "edit any checklistapi checklist" permission.');
  $permissions = array(
    'edit example_checklist checklistapi checklist',
  );
  $semi_privileged_user = $this
    ->drupalCreateUser($permissions);
  $this
    ->drupalLogin($semi_privileged_user);
  $this
    ->drupalGet('admin/config/development/checklistapi-example');
  $this
    ->assertResponse(200, 'Granted access to user with checklist-specific permission.');
  $this
    ->drupalLogout();
  $this
    ->drupalGet('admin/config/development/checklistapi-example');
  $this
    ->assertResponse(403, 'Denied access to nonprivileged user.');
}