function BotchaTestCase::testBotchaAfterCommentPreview in BOTCHA Spam Prevention 6
Same name and namespace in other branches
- 7 botcha.test \BotchaTestCase::testBotchaAfterCommentPreview()
Test if BOTCHA is applied when previewing comments: comment preview should have BOTCHA again.
\see testBotchaAfterNodePreview()
File
- ./
botcha.test, line 349 - Tests for BOTCHA module.
Class
Code
function testBotchaAfterCommentPreview() {
// Set Test BOTCHA on comment form.
botcha_set_form_id_setting(self::COMMENT_FORM_ID, 'test');
// Log in as normal user.
$this
->drupalLogin($this->normal_user);
// Create a node with comments enabled.
$node = $this
->createNodeWithCommentsEnabled();
// Check if there is a BOTCHA on the comment form (look for the title).
$this
->drupalGet('comment/reply/' . $node->nid);
$this
->assertBotchaPresence(TRUE);
// Preview comment with correct BOTCHA.
$edit = $this
->setCommentFormValues();
$this
->drupalPost('comment/reply/' . $node->nid, $edit, t('Preview'));
// Check that there is still BOTCHA after preview.
$this
->assertBotchaPresence(TRUE);
}