Bugzilla – Attachment 141106 Details for
Bug 25936
Notify users if their password has changed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25936: Unit tests
Bug-25936-Unit-tests.patch (text/plain), 2.26 KB, created by
Marcel de Rooy
on 2022-09-30 07:15:51 UTC
(
hide
)
Description:
Bug 25936: Unit tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-09-30 07:15:51 UTC
Size:
2.26 KB
patch
obsolete
>From 639453b1493fb86d15fa829917769a3ab80d449e Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 29 Sep 2022 12:42:39 +0100 >Subject: [PATCH] Bug 25936: Unit tests >Content-Type: text/plain; charset=utf-8 > >This patch adds a unit test to check that the notice is enqueued and >sending is attempted immediately. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Koha/Patrons.t | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index c8f8ce32af..7a2f4597bf 100755 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -1925,15 +1925,18 @@ subtest '->store' => sub { > > subtest '->set_password' => sub { > >- plan tests => 14; >+ plan tests => 16; > > $schema->storage->txn_begin; > > my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { login_attempts => 3 } } ); > >- # Disable logging password changes for this tests >+ # Disable logging password changes for these tests > t::lib::Mocks::mock_preference( 'BorrowersLog', 0 ); > >+ # Disable notifying patrons of password changes for these tests >+ t::lib::Mocks::mock_preference( 'NotifyPasswordChange', 0 ); >+ > # Password-length tests > t::lib::Mocks::mock_preference( 'minPasswordLength', undef ); > throws_ok { $patron->set_password({ password => 'ab' }); } >@@ -1998,6 +2001,14 @@ subtest '->set_password' => sub { > $number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'CHANGE PASS', object => $patron->borrowernumber } )->count; > is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->set_password does log password changes' ); > >+ # Enable notifying patrons of password changes >+ t::lib::Mocks::mock_preference( 'NotifyPasswordChange', 1 ); >+ $patron->set_password({ password => 'abcd c' }); >+ my $queued_notices = Koha::Notice::Messages->search({ borrowernumber => $patron->borrowernumber }); >+ is( $queued_notices->count, 1, "One notice queued when NotifyPassowrdChange enabled" ); >+ my $THE_notice = $queued_notices->next; >+ is( $THE_notice->status, 'failed', "The notice was sent immediately"); >+ > $schema->storage->txn_rollback; > }; > >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25936
:
131316
|
131317
|
131318
|
131319
|
131519
|
131520
|
131521
|
131543
|
141080
|
141081
|
141082
|
141104
|
141105
| 141106 |
141107
|
141108
|
141306
|
141307