public function LostCharacterCaptchaTestCase::testLostCharacterCaptchaOnLoginBlockOnAdminPagesIssue893810 in CAPTCHA Pack 8
Lost Character CAPTCHA is put on admin pages even if user has no access.
File
- text_captcha/
modules/ lost_character_captcha/ src/ Tests/ LostCharacterCaptchaTestCase.php, line 196
Class
- LostCharacterCaptchaTestCase
- Tests Lost character CAPTCHA main test case sensitivity.
Namespace
Drupal\lost_character_captcha\TestsCode
public function testLostCharacterCaptchaOnLoginBlockOnAdminPagesIssue893810() {
// Set a CAPTCHA on login block form.
/* @var \Drupal\captcha\Entity\CaptchaPoint $captcha_point */
$captcha_point = \Drupal::entityTypeManager()
->getStorage('captcha_point')
->load('user_login_form');
$captcha_point
->setCaptchaType('lost_character_captcha/Lost characters');
$captcha_point
->enable()
->save();
// Enable the user login block.
$this
->drupalPlaceBlock('user_login_block', [
'id' => 'login',
]);
// Check if there is a CAPTCHA on home page.
$this
->drupalGet('');
$this
->assertCaptchaPresence(TRUE);
// Check there is a CAPTCHA on "forbidden" admin pages.
$this
->drupalGet('admin');
$this
->assertCaptchaPresence(TRUE);
}