Bugzilla – Attachment 85636 Details for
Bug 22363
Move C4::Logs::GetLogs to Koha namespace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22363: Update Circulation.t to use Koha::ActionLogs instead of GetLogs
Bug-22363-Update-Circulationt-to-use-KohaActionLog.patch (text/plain), 5.72 KB, created by
Katrin Fischer
on 2019-02-25 18:22:07 UTC
(
hide
)
Description:
Bug 22363: Update Circulation.t to use Koha::ActionLogs instead of GetLogs
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2019-02-25 18:22:07 UTC
Size:
5.72 KB
patch
obsolete
>From 9bef1ee0458c3f365c9a85eaf28d6a10ed054763 Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Sun, 17 Feb 2019 22:45:07 +0000 >Subject: [PATCH] Bug 22363: Update Circulation.t to use Koha::ActionLogs > instead of GetLogs > >Test plan: >prove t/db_dependent/Circulation.t > >Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/Circulation.t | 45 +++++++++++++++++++++++++++++--------------- > 1 file changed, 30 insertions(+), 15 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 707582d44a..a170ac402c 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -43,6 +43,7 @@ use Koha::Patrons; > use Koha::Subscriptions; > use Koha::Account::Lines; > use Koha::Account::Offsets; >+use Koha::ActionLogs; > > my $schema = Koha::Database->schema; > $schema->storage->txn_begin; >@@ -466,17 +467,27 @@ my ( $reused_itemnumber_1, $reused_itemnumber_2 ); > ); > > t::lib::Mocks::mock_preference('RenewalLog', 0); >- my $date = output_pref( { dt => dt_from_string(), datenonly => 1, dateformat => 'iso' } ); >- my $old_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); >+ my $date = output_pref( { dt => dt_from_string(), dateonly => 1, dateformat => 'iso' } ); >+ my %params_renewal = ( >+ timestamp => { -like => $date . "%" }, >+ module => "CIRCULATION", >+ action => "RENEWAL", >+ ); >+ my %params_issue = ( >+ timestamp => { -like => $date . "%" }, >+ module => "CIRCULATION", >+ action => "ISSUE" >+ ); >+ my $old_log_size = Koha::ActionLogs->count( \%params_renewal ); > AddRenewal( $renewing_borrower->{borrowernumber}, $item_7->itemnumber, $branch ); >- my $new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); >+ my $new_log_size = Koha::ActionLogs->count( \%params_renewal ); > is ($new_log_size, $old_log_size, 'renew log not added because of the syspref RenewalLog'); > > t::lib::Mocks::mock_preference('RenewalLog', 1); >- $date = output_pref( { dt => dt_from_string(), datenonly => 1, dateformat => 'iso' } ); >- $old_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); >+ $date = output_pref( { dt => dt_from_string(), dateonly => 1, dateformat => 'iso' } ); >+ $old_log_size = Koha::ActionLogs->count( \%params_renewal ); > AddRenewal( $renewing_borrower->{borrowernumber}, $item_7->itemnumber, $branch ); >- $new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); >+ $new_log_size = Koha::ActionLogs->count( \%params_renewal ); > is ($new_log_size, $old_log_size + 1, 'renew log successfully added'); > > my $fines = Koha::Account::Lines->search( { borrowernumber => $renewing_borrower->{borrowernumber}, itemnumber => $item_7->itemnumber } ); >@@ -486,12 +497,12 @@ my ( $reused_itemnumber_1, $reused_itemnumber_2 ); > $fines->delete(); > > >- my $old_issue_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["ISSUE"]) } ); >- my $old_renew_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); >+ my $old_issue_log_size = Koha::ActionLogs->count( \%params_issue ); >+ my $old_renew_log_size = Koha::ActionLogs->count( \%params_renewal ); > AddIssue( $renewing_borrower,$item_7->barcode,Koha::DateUtils::output_pref({str=>$datedue6->date_due, dateformat =>'iso'}),0,$date, 0, undef ); >- $new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["RENEWAL"]) } ); >+ $new_log_size = Koha::ActionLogs->count( \%params_renewal ); > is ($new_log_size, $old_renew_log_size + 1, 'renew log successfully added when renewed via issuing'); >- $new_log_size = scalar(@{GetLogs( $date, $date, undef,["CIRCULATION"], ["ISSUE"]) } ); >+ $new_log_size = Koha::ActionLogs->count( \%params_issue ); > is ($new_log_size, $old_issue_log_size, 'renew not logged as issue when renewed via issuing'); > > $fines = Koha::Account::Lines->search( { borrowernumber => $renewing_borrower->{borrowernumber}, itemnumber => $item_7->itemnumber } ); >@@ -2868,19 +2879,23 @@ subtest 'AddRenewal and AddIssuingCharge tests' => sub { > > # Check the item out > AddIssue( $patron->unblessed, $item->barcode ); >- > t::lib::Mocks::mock_preference( 'RenewalLog', 0 ); > my $date = output_pref( { dt => dt_from_string(), datenonly => 1, dateformat => 'iso' } ); >- my $old_log_size = scalar( @{ GetLogs( $date, $date, undef, ["CIRCULATION"], ["RENEWAL"] ) } ); >+ my %params_renewal = ( >+ timestamp => { -like => $date . "%" }, >+ module => "CIRCULATION", >+ action => "RENEWAL", >+ ); >+ my $old_log_size = Koha::ActionLogs->count( \%params_renewal );; > AddRenewal( $patron->id, $item->id, $library->id ); >- my $new_log_size = scalar( @{ GetLogs( $date, $date, undef, ["CIRCULATION"], ["RENEWAL"] ) } ); >+ my $new_log_size = Koha::ActionLogs->count( \%params_renewal ); > is( $new_log_size, $old_log_size, 'renew log not added because of the syspref RenewalLog' ); > > t::lib::Mocks::mock_preference( 'RenewalLog', 1 ); > $date = output_pref( { dt => dt_from_string(), datenonly => 1, dateformat => 'iso' } ); >- $old_log_size = scalar( @{ GetLogs( $date, $date, undef, ["CIRCULATION"], ["RENEWAL"] ) } ); >+ $old_log_size = Koha::ActionLogs->count( \%params_renewal ); > AddRenewal( $patron->id, $item->id, $library->id ); >- $new_log_size = scalar( @{ GetLogs( $date, $date, undef, ["CIRCULATION"], ["RENEWAL"] ) } ); >+ $new_log_size = Koha::ActionLogs->count( \%params_renewal ); > is( $new_log_size, $old_log_size + 1, 'renew log successfully added' ); > > my $lines = Koha::Account::Lines->search({ >-- >2.11.0
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 22363
:
85248
|
85249
|
85250
|
85253
|
85254
|
85261
|
85594
|
85595
|
85596
|
85597
|
85632
|
85633
|
85634
|
85635
|
85636
|
85637
|
85749
|
85750
|
85751
|
85752
|
85753