Skip to content
Snippets Groups Projects
Commit d76b51ad authored by Flocon de toile's avatar Flocon de toile Committed by flocondetoile
Browse files

Issue #3297896 by flocondetoile: Automated Drupal 10 compatibility fixes

parent a51f456f
No related branches found
Tags 9.4.8
No related merge requests found
name: 'Protect Form Flood Control'
type: module
description: 'Provide flood control protection on any form.'
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^9.1 || ^10
configure: 'protect_form_flood_control.settings'
package: 'Spam control'
......@@ -52,12 +52,12 @@ class ProtectFormFloodControlFormTest extends BrowserTestBase {
*
* @var array
*/
public static $modules = ['protect_form_flood_control', 'node', 'comment', 'contact'];
protected static $modules = ['protect_form_flood_control', 'node', 'comment', 'contact'];
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
// Enable modules required for this test.
parent::setUp();
......@@ -132,19 +132,22 @@ class ProtectFormFloodControlFormTest extends BrowserTestBase {
// Set up form and submit it.
$edit['name'] = $this->randomMachineName();
$edit['mail'] = $edit['name'] . '@example.com';
$this->drupalPostForm('user/register', $edit, $this->t('Create new account'));
$this->drupalGet('user/register');
$this->submitForm($edit, $this->t('Create new account'));
// Form should have been submitted successfully.
$this->assertSession()->pageTextContains('A welcome message with further instructions has been sent to your email address.');
$edit['name'] = $this->randomMachineName();
$edit['mail'] = $edit['name'] . '@example.com';
$this->drupalPostForm('user/register', $edit, $this->t('Create new account'));
$this->drupalGet('user/register');
$this->submitForm($edit, $this->t('Create new account'));
// Form should have been submitted successfully.
$this->assertSession()->pageTextContains('A welcome message with further instructions has been sent to your email address.');
$edit['name'] = $this->randomMachineName();
$edit['mail'] = $edit['name'] . '@example.com';
$this->drupalPostForm('user/register', $edit, $this->t('Create new account'));
$this->drupalGet('user/register');
$this->submitForm($edit, $this->t('Create new account'));
$window = \Drupal::service('date.formatter')->formatInterval(60);
$this->assertSession()->pageTextContains("You cannot submit the form more than 2 times in $window. Please, try again later.");
......@@ -160,13 +163,16 @@ class ProtectFormFloodControlFormTest extends BrowserTestBase {
// Set up form and submit it.
$edit["comment_body[0][value]"] = $comment;
$this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, $this->t('Save'));
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
$this->submitForm($edit, $this->t('Save'));
$this->assertSession()->pageTextContains('Your comment has been queued for review');
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
$this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, $this->t('Save'));
$this->submitForm($edit, $this->t('Save'));
$this->assertSession()->pageTextContains('Your comment has been queued for review');
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
$this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, $this->t('Save'));
$this->submitForm($edit, $this->t('Save'));
$window = \Drupal::service('date.formatter')->formatInterval(60);
$this->assertSession()->pageTextContains("You cannot submit the form more than 2 times in $window. Please, try again later.");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment