Bugzilla – Attachment 72609 Details for
Bug 18626
Add ability to track cardnumber changes for patrons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18626: Add unit tests
Bug-18626-Add-unit-tests.patch (text/plain), 1.79 KB, created by
Kyle M Hall (khall)
on 2018-03-09 15:02:41 UTC
(
hide
)
Description:
Bug 18626: Add unit tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-03-09 15:02:41 UTC
Size:
1.79 KB
patch
obsolete
>From 44f19b9d67b1d2365fd7089c1095edbbc8237fc0 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatetsolutions.com> >Date: Fri, 9 Mar 2018 09:51:52 -0500 >Subject: [PATCH] Bug 18626: Add unit tests > >--- > t/db_dependent/Koha/Patrons.t | 21 ++++++++++++++++++++- > 1 file changed, 20 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 2323d21..c494241 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -19,10 +19,11 @@ > > use Modern::Perl; > >-use Test::More tests => 25; >+use Test::More tests => 26; > use Test::Warn; > use Time::Fake; > use DateTime; >+use JSON; > > use C4::Biblio; > use C4::Circulation; >@@ -1121,6 +1122,24 @@ subtest 'is_child | is_adult' => sub { > $retrieved_patron_1->delete; > is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); > >+subtest 'Log cardnumber change' => sub { >+ plan tests => 3; >+ >+ t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); >+ my $patron = $builder->build( { source => 'Borrower' } ); >+ >+ my $cardnumber = $patron->{cardnumber}; >+ $patron->{cardnumber} = 'TESTCARDNUMBER'; >+ ModMember(%$patron); >+ >+ my @logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'MODIFY', object => $patron->{borrowernumber} } ); >+ my $log_info = from_json( $logs[0]->info ); >+ is( $log_info->{cardnumber_replaced}->{new_cardnumber}, 'TESTCARDNUMBER', 'Got correct new cardnumber' ); >+ is( $log_info->{cardnumber_replaced}->{previous_cardnumber}, $cardnumber, 'Got correct old cardnumber' ); >+ is( scalar @logs, 2, 'With BorrowerLogs, Change in cardnumber should be logged, as well as general alert of patron mod.' ); >+}; >+ >+ > $schema->storage->txn_rollback; > > # TODO Move to t::lib::Mocks and reuse it! >-- >2.10.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 18626
:
63532
|
63560
|
69467
|
72607
|
72608
| 72609