public function SimpleRecaptchaWebformJavascriptTestBase::configureModule in Simple Google reCAPTCHA 8
Helper to configure the module.
We need to set up reCAPTCHA test keys to make form alteration works. Currently there's no way to set default config for testing.
@TODO duplicate - move this logic to some sort of Trait.
Parameters
string $type: Type to reCAPTCHA to use, v2 or v3.
See also
https://www.drupal.org/project/drupal/issues/913086
2 calls to SimpleRecaptchaWebformJavascriptTestBase::configureModule()
- SimpleRecaptchaWebformJavascriptTest::testContactWebform in modules/
simple_recaptcha_webform/ tests/ src/ FunctionalJavascript/ SimpleRecaptchaWebformJavascriptTest.php - Check if reCAPTCHA validation is added to contact webform.
- SimpleRecaptchaWebformJavascriptTest::testRecaptchaLibraries in modules/
simple_recaptcha_webform/ tests/ src/ FunctionalJavascript/ SimpleRecaptchaWebformJavascriptTest.php - Verify that libraries are loaded correctly for different reCAPTCHA versions.
File
- modules/
simple_recaptcha_webform/ tests/ src/ FunctionalJavascript/ SimpleRecaptchaWebformJavascriptTestBase.php, line 81
Class
- SimpleRecaptchaWebformJavascriptTestBase
- JavaScripts tests for the Simple reCAPTCHA webform module.
Namespace
Drupal\Tests\simple_recaptcha_webform\FunctionalJavascriptCode
public function configureModule($type = 'v2') {
$config = [
'recaptcha_type' => $type,
'site_key' => '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI',
'secret_key' => '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe',
'site_key_v3' => '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI',
'secret_key_v3' => '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe',
'form_ids' => 'user_login_form,user_pass,user_register_form',
'v3_score' => 80,
];
\Drupal::configFactory()
->getEditable('simple_recaptcha.config')
->setData($config)
->save();
}