You are here

private function ForumAccessTestCase::testForumAccessViewForum in Forum Access 6

This function test if the user can view a forum

1 call to ForumAccessTestCase::testForumAccessViewForum()
ForumAccessTestCase::testForumAccessRun in ./forum_access.test
The main function which is used to start testing a specific forum configuration.

File

./forum_access.test, line 505
Test file for forum_access.module.

Class

ForumAccessTestCase
This is the base class for forum access testing.

Code

private function testForumAccessViewForum() {
  if (intval($this->testForumAccessCurrentForumId) > 0) {
    $allowed = $this
      ->testForumAccessAllowed('forum_view');

    // Check to see if the user/anonymous is allowed to view forum
    $this
      ->drupalGet('forum/' . $this->testForumAccessCurrentForumId);
    if ($allowed) {
      if (!$this
        ->assertNoText("not authorized", t('@user should be allowed to view this forum: @page', array(
        '@user' => $this->loggedInUser ? t('The user') : t('Anonymous'),
        '@page' => $this
          ->getUrl(),
      )))) {
        $this
          ->testForumAccessDumpDebugInfo();
      }
    }
    else {
      if (!$this
        ->assertText("not authorized", t('@user should NOT be allowed to view this forum: @page', array(
        '@user' => $this->loggedInUser ? t('The user') : t('Anonymous'),
        '@page' => $this
          ->getUrl(),
      )))) {
        $this
          ->testForumAccessDumpDebugInfo();
      }
    }
  }
}