Bugzilla – Attachment 104739 Details for
Bug 25417
Backdating returns and forgiving fines causes and internal server error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25417: (QA follow-up) Add integration test for AddReturn
Bug-25417-QA-follow-up-Add-integration-test-for-Ad.patch (text/plain), 3.67 KB, created by
Martin Renvoize (ashimema)
on 2020-05-12 08:32:17 UTC
(
hide
)
Description:
Bug 25417: (QA follow-up) Add integration test for AddReturn
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-05-12 08:32:17 UTC
Size:
3.67 KB
patch
obsolete
>From 9f11b86214771ff72c5952c5549d488a06f44fb9 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 12 May 2020 09:24:28 +0100 >Subject: [PATCH] Bug 25417: (QA follow-up) Add integration test for AddReturn > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Circulation.t | 50 +++++++++++++++++++++++++++++++++--- > 1 file changed, 46 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index e765b77840..42b18d1d11 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -2337,7 +2337,7 @@ subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub { > > > subtest 'AddReturn | is_overdue' => sub { >- plan tests => 5; >+ plan tests => 6; > > t::lib::Mocks::mock_preference('MarkLostItemsAsReturned', 'batchmod|moredetail|cronjob|additem|pendingreserves|onpayment'); > t::lib::Mocks::mock_preference('CalculateFinesOnReturn', 1); >@@ -2432,7 +2432,49 @@ subtest 'AddReturn | is_overdue' => sub { > AddReturn( $item->{barcode}, $library->{branchcode} ); > is( int( $patron->account->balance() ), > 17, "Should have a single 10 days overdue fine and lost charge" ); >- } >+ >+ # Cleanup >+ Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber })->delete; >+ }; >+ >+ subtest 'bug 25417 | backdated return + exemptfine' => sub { >+ >+ plan tests => 6; >+ >+ t::lib::Mocks::mock_preference('CalculateFinesOnBackdate', 1); >+ >+ my $issue = AddIssue( $patron->unblessed, $item->{barcode}, $one_day_ago ); # date due was 1d ago >+ >+ # Fake fines cronjob on this checkout >+ my ($fine) = >+ CalcFine( $item, $patron->categorycode, $library->{branchcode}, >+ $one_day_ago, $now ); >+ UpdateFine( >+ { >+ issue_id => $issue->issue_id, >+ itemnumber => $item->{itemnumber}, >+ borrowernumber => $patron->borrowernumber, >+ amount => $fine, >+ due => output_pref($one_day_ago) >+ } >+ ); >+ is( int( $patron->account->balance() ), >+ 1, "Overdue fine of 1 day overdue" ); >+ >+ # Backdated return (dropbox mode example - charge should exist but be zero) >+ AddReturn( $item->{barcode}, $library->{branchcode}, 1, $one_day_ago ); >+ is( int( $patron->account->balance() ), >+ 0, "Overdue fine should be annulled" ); >+ my $lines = Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber }); >+ is( $lines->count, 1, "Overdue fine accountlines still exists"); >+ my $line = $lines->next; >+ is($line->amount+0,0, "Overdue fine amount has been reduced to 0"); >+ is($line->amountoutstanding+0,0, "Overdue fine amount outstanding has been reduced to 0"); >+ is($line->status,'RETURNED', "Overdue fine was fixed"); >+ >+ # Cleanup >+ Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber })->delete; >+ }; > }; > > subtest '_FixAccountForLostAndFound' => sub { >@@ -2891,8 +2933,8 @@ subtest '_FixOverduesOnReturn' => sub { > is( ref $credit, "Koha::Account::Line", "Found matching credit for fine forgiveness" ); > is( $credit->amount + 0, -99, "Credit amount is set correctly" ); > is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" ); >- >- # Bug 25417 - Only forgive fines where there is an amount oustanding to forgive >+ >+ # Bug 25417 - Only forgive fines where there is an amount outstanding to forgive > $accountline->set( > { > debit_type_code => 'OVERDUE', >-- >2.20.1
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 25417
:
104535
|
104536
|
104575
|
104576
|
104578
|
104579
|
104580
|
104644
|
104645
|
104715
|
104716
|
104730
|
104731
|
104732
|
104733
|
104734
|
104735
|
104736
|
104737
|
104738
|
104739
|
104749
|
104750
|
104751
|
104752
|
104753
|
104754