public function BotchaSessionReuseAttackTestCase::testMultipleBotchaProtectedFormsOnOnePage in BOTCHA Spam Prevention 6
Same name and namespace in other branches
- 7 botcha.test \BotchaSessionReuseAttackTestCase::testMultipleBotchaProtectedFormsOnOnePage()
File
- ./
botcha.test, line 1003 - Tests for BOTCHA module.
Class
Code
public function testMultipleBotchaProtectedFormsOnOnePage() {
// Set Test BOTCHA on comment form and login block
botcha_set_form_id_setting(self::COMMENT_FORM_ID, 'test');
botcha_set_form_id_setting('user_login_block', 'test');
$this
->allowCommentPostingForAnonymousVisitors();
// Create a node with comments enabled.
$node = $this
->createNodeWithCommentsEnabled();
// Preview comment with correct BOTCHA answer.
$edit = $this
->setCommentFormValues();
$comment_subject = $edit['subject'];
$this
->drupalPost('comment/reply/' . $node->nid, $edit, t('Preview'));
// Post should be accepted: no warnings,
// no BOTCHA reuse detection (which could be used by user log in block).
$this
->assertBotchaResponseAccepted();
$this
->assertText($comment_subject);
}