public function CaptchaTest::testCaptchaSessionReuseOnNodeForms in CAPTCHA 8
Test if the CAPTCHA session ID is reused when previewing nodes.
Node preview after correct response should not show CAPTCHA anymore. 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
- tests/
src/ Functional/ CaptchaTest.php, line 213
Class
- CaptchaTest
- Tests CAPTCHA main test case sensitivity.
Namespace
Drupal\Tests\captcha\FunctionalCode
public function testCaptchaSessionReuseOnNodeForms() {
// Set Test CAPTCHA on page form.
captcha_set_form_id_setting('node_page_form', '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
->submitForm($edit, $this
->t('Preview'));
$this
->assertCaptchaPresence(FALSE);
}