Skip to content
Snippets Groups Projects

Applied patch and also used Rector

2 files
+ 9
6
Compare changes
  • Side-by-side
  • Inline

Files

@@ -35,7 +35,7 @@ class FriendlyCaptchaBasicTest extends BrowserTestBase {
*
* @var array
*/
public static $modules = ['friendlycaptcha', 'captcha'];
protected static $modules = ['friendlycaptcha', 'captcha'];
/**
* {@inheritdoc}
@@ -45,7 +45,7 @@ class FriendlyCaptchaBasicTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
protected function setUp(): void {
parent::setUp();
module_load_include('inc', 'captcha');
@@ -111,7 +111,8 @@ class FriendlyCaptchaBasicTest extends BrowserTestBase {
// Check form validation.
$edit['friendlycaptcha_site_key'] = '';
$edit['friendlycaptcha_api_key'] = '';
$this->drupalPostForm('admin/config/people/captcha/friendlycaptcha', $edit, $this->t('Save configuration'));
$this->drupalGet('admin/config/people/captcha/friendlycaptcha');
$this->submitForm($edit, $this->t('Save configuration'));
$this->assertSession()->responseContains($this->t('Site key field is required.'), '[testFriendlycaptchaAdminSettingsForm]: Empty site key detected.');
$this->assertSession()->responseContains($this->t('API key field is required.'), '[testFriendlycaptchaAdminSettingsForm]: Empty api key detected.');
@@ -120,7 +121,8 @@ class FriendlyCaptchaBasicTest extends BrowserTestBase {
$edit['friendlycaptcha_site_key'] = $site_key;
$edit['friendlycaptcha_api_key'] = $api_key;
$edit['friendlycaptcha_api_endpoint'] = $endpoint;
$this->drupalPostForm('admin/config/people/captcha/friendlycaptcha', $edit, $this->t('Save configuration'));
$this->drupalGet('admin/config/people/captcha/friendlycaptcha');
$this->submitForm($edit, $this->t('Save configuration'));
$this->assertSession()->responseContains($this->t('The configuration options have been saved.'), '[testFriendlycaptchaAdminSettingsForm]: The configuration options have been saved.');
$this->assertSession()->responseNotContains($this->t('Site key field is required.'), '[testFriendlycaptchaAdminSettingsForm]: Site key was not empty.');
@@ -188,8 +190,9 @@ class FriendlyCaptchaBasicTest extends BrowserTestBase {
$this->assertSession()
->hiddenFieldExists('captcha_response')
->setValue('?');
$this->drupalGet('user/login');
$this->drupalPostForm('user/login', $edit, $this->t('Log in'));
$this->submitForm($edit, $this->t('Log in'));
// Check for error message.
$this->assertSession()->pageTextContains($this->t('The answer you entered for the CAPTCHA was not correct.'), 'CAPTCHA should block user login form', 'Friendlycaptcha');
Loading