Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
agreement
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
9
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
agreement
Merge requests
!12
Issue
#3418398
: Refactors frequency session checking
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3418398
: Refactors frequency session checking
issue/agreement-3418398:3418398-refactor-frequency-session
into
3.0.x
Overview
0
Commits
1
Pipelines
1
Changes
1
Open
Matthew Radcliffe
requested to merge
issue/agreement-3418398:3418398-refactor-frequency-session
into
3.0.x
11 months ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
Closes
#3418398
👍
0
👎
0
Merge request reports
Compare
3.0.x
3.0.x (HEAD)
and
latest version
latest version
5cb31ff8
1 commit,
11 months ago
1 file
+
59
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
tests/src/Functional/AgreementChangePasswordTest.php
0 → 100644
+
59
−
0
Options
<?php
namespace
Drupal\Tests\agreement\Functional
;
/**
* Tests user not required to agree after changing password.
*
* When an agreement requires a user to agree on every login, the user should
* not be required to agree when they change their password because Drupal
* considers this a session change and agreement considers a new session a new
* login.
*
* @group agreement
*/
class
AgreementChangePasswordTest
extends
AgreementTestBase
{
/**
* User account to test custom frequency.
*
* @var \Drupal\Core\Session\AccountInterface
*/
protected
$unprivilegedAccount
;
/**
* {@inheritdoc}
*/
protected
function
setUp
():
void
{
parent
::
setUp
();
// Sets the frequency to a quarter of a day.
$settings
=
$this
->
agreement
->
getSettings
();
$settings
[
'frequency'
]
=
0
;
$this
->
agreement
->
set
(
'settings'
,
$settings
);
$this
->
agreement
->
save
();
$this
->
unprivilegedAccount
=
$this
->
createUnprivilegedUser
();
}
/**
* Tests that every login agreement gets auto-agreed after password change.
*/
public
function
testUpdatePassword
():
void
{
$this
->
drupalLogin
(
$this
->
unprivilegedAccount
);
$this
->
assertAgreementPage
(
$this
->
agreement
);
$this
->
assertAgreed
(
$this
->
agreement
);
$this
->
drupalGet
(
'/user/'
.
$this
->
unprivilegedAccount
->
id
()
.
'/edit'
);
$newPass
=
\Drupal
::
service
(
'password_generator'
)
->
generate
();
$this
->
submitForm
([
'current_pass'
=>
$this
->
unprivilegedAccount
->
passRaw
,
'pass[pass1]'
=>
$newPass
,
'pass[pass2]'
=>
$newPass
,
],
'Save'
);
$this
->
assertNotAgreementPage
(
$this
->
agreement
);
}
}
Loading