Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
honeypot-3344479
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
honeypot-3344479
Commits
d53aa16f
Commit
d53aa16f
authored
10 years ago
by
Jeff Geerling
Browse files
Options
Downloads
Patches
Plain Diff
Make tests work with Drupal 8 again.
parent
4733d23a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/Drupal/honeypot/Tests/HoneypotFormTest.php
+7
-6
7 additions, 6 deletions
lib/Drupal/honeypot/Tests/HoneypotFormTest.php
with
7 additions
and
6 deletions
lib/Drupal/honeypot/Tests/HoneypotFormTest.php
+
7
−
6
View file @
d53aa16f
...
...
@@ -9,6 +9,7 @@ namespace Drupal\honeypot\Tests;
use
Drupal\simpletest\WebTestBase
;
use
Drupal\Core\Database\Database
;
use
Drupal\comment\Plugin\Field\FieldType\CommentItemInterface
;
/**
* Test the functionality of the Honeypot module for an admin user.
...
...
@@ -38,7 +39,7 @@ class HoneypotFormTest extends WebTestBase {
parent
::
setUp
();
// Set up required Honeypot configuration.
$honeypot_config
=
config
(
'honeypot.settings'
);
$honeypot_config
=
\Drupal
::
config
(
'honeypot.settings'
);
$honeypot_config
->
set
(
'element_name'
,
'url'
);
// Disable time_limit protection.
$honeypot_config
->
set
(
'time_limit'
,
0
);
...
...
@@ -48,7 +49,7 @@ class HoneypotFormTest extends WebTestBase {
$honeypot_config
->
save
();
// Set up other required configuration.
$user_config
=
config
(
'user.settings'
);
$user_config
=
\Drupal
::
config
(
'user.settings'
);
$user_config
->
set
(
'verify_mail'
,
TRUE
);
$user_config
->
set
(
'register'
,
USER_REGISTER_VISITORS
);
$user_config
->
save
();
...
...
@@ -82,7 +83,7 @@ class HoneypotFormTest extends WebTestBase {
// Set up example node.
$this
->
node
=
$this
->
drupalCreateNode
(
array
(
'type'
=>
'article'
,
'comment'
=>
C
OMMENT_
OPEN
,
'comment'
=>
C
ommentItemInterface
::
OPEN
,
));
}
...
...
@@ -112,7 +113,7 @@ class HoneypotFormTest extends WebTestBase {
public
function
testProtectRegisterUserTooFast
()
{
// Enable time limit for honeypot.
$honeypot_config
=
config
(
'honeypot.settings'
)
->
set
(
'time_limit'
,
5
)
->
save
();
$honeypot_config
=
\Drupal
::
config
(
'honeypot.settings'
)
->
set
(
'time_limit'
,
5
)
->
save
();
// Set up form and submit it.
$edit
[
'name'
]
=
$this
->
randomName
();
...
...
@@ -130,7 +131,7 @@ class HoneypotFormTest extends WebTestBase {
$comment
=
'Test comment.'
;
// Disable time limit for honeypot.
$honeypot_config
=
config
(
'honeypot.settings'
)
->
set
(
'time_limit'
,
0
)
->
save
();
$honeypot_config
=
\Drupal
::
config
(
'honeypot.settings'
)
->
set
(
'time_limit'
,
0
)
->
save
();
// Log in the web user.
$this
->
drupalLogin
(
$this
->
webUser
);
...
...
@@ -171,7 +172,7 @@ class HoneypotFormTest extends WebTestBase {
$this
->
drupalLogin
(
$this
->
webUser
);
// Reset the time limit to 5 seconds.
$honeypot_config
=
config
(
'honeypot.settings'
)
->
set
(
'time_limit'
,
5
)
->
save
();
$honeypot_config
=
\Drupal
::
config
(
'honeypot.settings'
)
->
set
(
'time_limit'
,
5
)
->
save
();
// Set up the form and submit it.
$edit
[
"title[0][value]"
]
=
'Test Page'
;
...
...
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