public function LostCharacterCaptchaTestCase::testLostCharacterCaptchaSessionReuseOnNodeForms in CAPTCHA Pack 8
Test if the Lost Character CAPTCHA sessionID is reused on previewing nodes.
Node preview after correct response should not show Lost character CAPTCHA. The preview functionality of comments and nodes works slightly different under the hood. CAPTCHA module should be able to handle both.
See also
testCaptchaDescriptionAfterCommentPreview()
File
- text_captcha/
modules/ lost_character_captcha/ src/ Tests/ LostCharacterCaptchaTestCase.php, line 177
Class
- LostCharacterCaptchaTestCase
- Tests Lost character CAPTCHA main test case sensitivity.
Namespace
Drupal\lost_character_captcha\TestsCode
public function testLostCharacterCaptchaSessionReuseOnNodeForms() {
// Set Test CAPTCHA on page form.
captcha_set_form_id_setting('node_page_form', 'lost_character_captcha/Test');
// Log in as normal user.
$this
->drupalLogin($this->normalUser);
// Page settings to post, with correct CAPTCHA answer.
$edit = $this
->getNodeFormValues();
$edit['captcha_response'] = 'Test 123';
$this
->drupalGet('node/add/page');
$this
->drupalPostForm(NULL, $edit, t('Preview'));
$this
->assertCaptchaPresence(FALSE);
}