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