function BotchaTestCase::testBotchaAfterNodePreview in BOTCHA Spam Prevention 7
Same name and namespace in other branches
- 6 botcha.test \BotchaTestCase::testBotchaAfterNodePreview()
Test if BOTCHA is applied when previewing nodes: node preview should have BOTCHA again. The preview functionality of comments and nodes works slightly different under the hood. BOTCHA module should be able to handle both.
\see testBotchaAfterCommentPreview()
File
- ./
botcha.test, line 380 - Tests for BOTCHA module.
Class
Code
function testBotchaAfterNodePreview() {
// Set Test BOTCHA on page form.
botcha_set_form_id_setting('page_node_form', 'test');
// Log in as normal user.
$this
->drupalLogin($this->normal_user);
// Check if there is a BOTCHA on the node form (look for the title).
$this
->drupalGet('node/add/page');
$this
->assertBotchaPresence(TRUE);
// Page settings to post, with correct BOTCHA answer.
$edit = $this
->setNodeFormValues();
// Preview the node
$this
->drupalPost('node/add/page', $edit, t('Preview'));
// Check that there is still BOTCHA after preview.
$this
->assertBotchaPresence(TRUE);
}