function ForumAccess11InitialConfigurationTestCase::testInitialConfiguration in Forum Access 7
File
- tests/
forum_access.test, line 83
Class
- ForumAccess11InitialConfigurationTestCase
- Initial configuration tests for the Forum Access module.
Code
function testInitialConfiguration() {
$this
->setUp2();
$this
->pass('#########################<br />#1 - START test initial configuration @' . (time() - $this->time), '######');
// Show permissions grid.
$this
->drupalGet('admin/people/permissions/list');
$this
->assertResponse(200, '^^^ Permissions');
// Show list of users.
$this
->drupalGet('admin/people');
$this
->assertResponse(200);
// Show list of users.
$this
->drupalGet('admin/people', array(
'query' => array(
'sort' => 'asc',
'order' => drupal_encode_path(t('Username')),
),
));
$this
->assertResponse(200, '^^^ Users');
// Show list of forums aka Forum Overview (only 'General discussion' at this point).
$this
->drupalGet('forum');
$this
->assertResponse(200, '^^^ Forums');
// Show administrative list of forums.
$this
->drupalGet('admin/structure/forum');
$this
->assertResponse(200, '^^^ Forum Administration Overview');
// Show default forum settings after installation of FA.
$this
->drupalGet('admin/structure/forum/edit/forum/1');
$this
->assertResponse(200, '^^^ Forum 1 Administration');
// Verify the checked state of the checkboxes.
foreach (array(
$this->webmaster_rid,
$this->forum_admin_rid,
$this->edit_any_content_rid,
$this->edit_own_content_rid,
$this->create_content_rid,
) as $rid) {
foreach ($this->accesses as $access) {
$this
->assertNoFieldChecked("edit-forum-access-grants-checkboxes-{$access}-{$rid}", "Role {$rid} does NOT have '{$access}'.");
}
}
$this
->assertNoFieldChecked("edit-forum-access-grants-checkboxes-view-3", "administrator does NOT have 'view'.");
$this
->assertNoFieldChecked("edit-forum-access-grants-checkboxes-create-3", "administrator does NOT have 'create'.");
$this
->assertFieldChecked("edit-forum-access-grants-checkboxes-update-3", "administrator has 'update'.");
$this
->assertFieldChecked("edit-forum-access-grants-checkboxes-delete-3", "administrator has 'delete'.");
$this
->assertFieldChecked("edit-forum-access-grants-checkboxes-view-1", "anonymous has 'view'.");
$this
->assertNoFieldChecked("edit-forum-access-grants-checkboxes-create-1", "anonymous does NOT have 'create'.");
$this
->assertNoFieldChecked("edit-forum-access-grants-checkboxes-update-1", "anonymous does NOT have 'update'.");
$this
->assertNoFieldChecked("edit-forum-access-grants-checkboxes-delete-1", "anonymous does NOT have 'delete'.");
$this
->assertFieldChecked("edit-forum-access-grants-checkboxes-view-2", "authenticated has 'view'.");
$this
->assertFieldChecked("edit-forum-access-grants-checkboxes-create-2", "authenticated has 'create'.");
$this
->assertNoFieldChecked("edit-forum-access-grants-checkboxes-update-2", "authenticated does NOT have 'update'.");
$this
->assertNoFieldChecked("edit-forum-access-grants-checkboxes-delete-2", "authenticated does NOT have 'delete'.");
// Verify the enabled/disabled state of the checkboxes.
foreach ($this->rids as $rid) {
foreach ($this->accesses as $access) {
$key = "{$access}-{$rid}";
if (array_search($key, array(
'update-3',
'delete-3',
)) !== FALSE) {
$this
->assertFieldDisabled("edit-forum-access-grants-checkboxes-{$key}");
}
else {
$this
->assertFieldEnabled("edit-forum-access-grants-checkboxes-{$key}");
}
}
}
// Remove the Drupal default forum.
$this
->drupalGet('forum/1');
$this
->assertResponse(200);
taxonomy_term_delete(1);
$this
->drupalGet('forum/1');
$this
->assertResponse(404);
$this
->drupalGet('forum');
$this
->assertResponse(200);
$this
->assertText(t('No forums defined'), 'Drupal default forum removed.');
$this
->pass('#########################<br />#1 - END test initial configuration @' . (time() - $this->time), '######');
}