Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
protect_form_flood_control
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
protect_form_flood_control
Commits
d76b51ad
Commit
d76b51ad
authored
1 year ago
by
Flocon de toile
Committed by
flocondetoile
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3297896
by flocondetoile: Automated Drupal 10 compatibility fixes
parent
a51f456f
No related branches found
Branches containing commit
Tags
9.4.8
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
protect_form_flood_control.info.yml
+1
-2
1 addition, 2 deletions
protect_form_flood_control.info.yml
tests/src/Functional/ProtectFormFloodControlFormTest.php
+14
-8
14 additions, 8 deletions
tests/src/Functional/ProtectFormFloodControlFormTest.php
with
15 additions
and
10 deletions
protect_form_flood_control.info.yml
+
1
−
2
View file @
d76b51ad
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'
This diff is collapsed.
Click to expand it.
tests/src/Functional/ProtectFormFloodControlFormTest.php
+
14
−
8
View file @
d76b51ad
...
...
@@ -52,12 +52,12 @@ class ProtectFormFloodControlFormTest extends BrowserTestBase {
*
* @var array
*/
p
ublic
static
$modules
=
[
'protect_form_flood_control'
,
'node'
,
'comment'
,
'contact'
];
p
rotected
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."
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment