Bugzilla – Attachment 87921 Details for
Bug 22632
Add logging of merged patrons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Unit Testing of patch 22632
Unit-Testing-of-patch-22632.patch (text/plain), 3.69 KB, created by
axel
on 2019-04-12 14:15:21 UTC
(
hide
)
Description:
Unit Testing of patch 22632
Filename:
MIME Type:
Creator:
axel
Created:
2019-04-12 14:15:21 UTC
Size:
3.69 KB
patch
obsolete
>From 4031b4e3f495b3d461a175503a872694a99d110d Mon Sep 17 00:00:00 2001 >From: Axel Amghar <axel.amghar@gmail.com> >Date: Fri, 12 Apr 2019 15:59:23 +0200 >Subject: [PATCH] Unit Testing of patch 22632 > >--- > t/db_dependent/Koha/Patron/Log.t | 77 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 77 insertions(+) > create mode 100644 t/db_dependent/Koha/Patron/Log.t > >diff --git a/t/db_dependent/Koha/Patron/Log.t b/t/db_dependent/Koha/Patron/Log.t >new file mode 100644 >index 0000000..93157c7 >--- /dev/null >+++ b/t/db_dependent/Koha/Patron/Log.t >@@ -0,0 +1,77 @@ >+# This file is part of Koha >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use Test::More tests => 1; >+ >+use C4::Log; >+ >+use t::lib::Mocks; >+use t::lib::TestBuilder; >+ >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+subtest 'Test Koha::Patrons::merge' => sub { >+ >+ plan tests => 4; >+ my $builder = t::lib::TestBuilder->new; >+ >+ my $keeper = $builder->build_object({ class => 'Koha::Patrons' }); >+ >+ my $borrower1 = $builder->build({source => 'Borrower'}); >+ my $borrower2 = $builder->build({source => 'Borrower'}); >+ my $borrower3 = $builder->build({source => 'Borrower'}); >+ my $borrower4 = $builder->build({source => 'Borrower'}); >+ >+ #test with BorrowersLog on >+ t::lib::Mocks::mock_preference('BorrowersLog', 1); >+ >+ my $results = $keeper->merge_with([ $borrower1->{borrowernumber}, $borrower2->{borrowernumber} ]); >+ >+ my $log=GetLogs("","","",["Patrons"],["Merge"],$borrower1->{borrowernumber},""); >+ >+ my $info_borrower1 = $borrower1->{firstname} . " " . $borrower1->{surname} . " (" . $borrower1->{cardnumber} . ") has been merged into " . >+ $keeper->firstname . " " . $keeper->surname . " (" . $keeper->cardnumber . ")"; >+ my $info_log = $log->[0]{info}; >+ >+ is($info_log,$info_borrower1,"GetLogs returns results in the log viewer for the merge of " . $borrower1->{borrowernumber}); >+ >+ $log=GetLogs("","","",["Patrons"],["Merge"],$borrower2->{borrowernumber},""); >+ >+ my $info_borrower2 = $borrower2->{firstname} . " " . $borrower2->{surname} . " (" . $borrower2->{cardnumber} . ") has been merged into " . >+ $keeper->firstname . " " . $keeper->surname . " (" . $keeper->cardnumber . ")"; >+ $info_log = $log->[0]{info}; >+ >+ is($info_log,$info_borrower2,"GetLogs returns results in the log viewer for the merge of " . $borrower2->{borrowernumber}); >+ >+ >+ #test with BorrowersLog off >+ t::lib::Mocks::mock_preference('BorrowersLog', 0); >+ >+ $results = $keeper->merge_with([ $borrower3->{borrowernumber}, $borrower4->{borrowernumber} ]); >+ >+ $log=GetLogs("","","",["Patrons"],["Merge"],$borrower3->{borrowernumber},""); >+ $info_log = $log->[0]{info}; >+ >+ is($info_log,undef,"GetLogs didn't returns results in the log viewer for the merge of " . $borrower3->{borrowernumber}); >+ >+ $log=GetLogs("","","",["Patrons"],["Merge"],$borrower4->{borrowernumber},""); >+ $info_log = $log->[0]{info}; >+ >+ is($info_log,undef,"GetLogs didn't returns results in the log viewer for the merge of " . $borrower4->{borrowernumber}); >+}; >+ >+$schema->storage->txn_rollback; >\ No newline at end of file >-- >2.7.4
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 22632
:
87778
|
87920
|
87921
|
87922
|
87923
|
87926
|
87995
|
87996
|
87997
|
87998
|
87999
|
88043
|
88044
|
88045
|
88046
|
89728
|
89729
|
89730
|
89731
|
157260
|
157261
|
157262
|
157263
|
157264
|
157265
|
157266
|
157267
|
157268
|
157269
|
157270
|
157271
|
157278
|
157281
|
157286
|
159553
|
159554
|
159555
|
159556
|
159557
|
159558