private function ForumAccessTestCase::testForumAccessViewTopic in Forum Access 6
This function test if the user can view a certain topic
1 call to ForumAccessTestCase::testForumAccessViewTopic()
- ForumAccessTestCase::testForumAccessRun in ./
forum_access.test - The main function which is used to start testing a specific forum configuration.
File
- ./
forum_access.test, line 569 - Test file for forum_access.module.
Class
- ForumAccessTestCase
- This is the base class for forum access testing.
Code
private function testForumAccessViewTopic($topic_id = 0) {
if (intval($topic_id) > 0) {
$allowed = $this
->testForumAccessAllowed('topic_view');
// Check to see if the user/anonymous is allowed to view topic
$this
->drupalGet('node/' . $topic_id);
if ($allowed) {
if (!$this
->assertNoText("not authorized", t('@user should be allowed to view this topic: @page', array(
'@user' => $this->loggedInUser ? t('The user') : t('Anonymous'),
'@page' => $this
->getUrl(),
)))) {
$this
->testForumAccessDumpDebugInfo('topic', $topic_id);
}
}
else {
if (!$this
->assertText("not authorized", t('@user should NOT be allowed to view this topic: @page', array(
'@user' => $this->loggedInUser ? t('The user') : t('Anonymous'),
'@page' => $this
->getUrl(),
)))) {
$this
->testForumAccessDumpDebugInfo('topic', $topic_id);
}
}
}
}