Bugzilla – Attachment 106525 Details for
Bug 8338
Add ability to remove fines with dropbox mode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8338: (follow-up) Fix test
Bug-8338-follow-up-Fix-test.patch (text/plain), 6.48 KB, created by
Katrin Fischer
on 2020-07-04 20:28:59 UTC
(
hide
)
Description:
Bug 8338: (follow-up) Fix test
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-07-04 20:28:59 UTC
Size:
6.48 KB
patch
obsolete
>From b01fab0e8b9f7c274e0adf6eea14bf7e8829e442 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 2 Jun 2020 17:37:38 +0100 >Subject: [PATCH] Bug 8338: (follow-up) Fix test > >This patch moves the previous test introduced with bug 24075 into the >same block as the rest of the AddReturn tests and updates it to test for >the new 'remove accountline' behaviour as well as the reduce and refund >behaviour. > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/Circulation.t | 138 +++++++++++++++++++++++++++++-------------- > 1 file changed, 93 insertions(+), 45 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index bc6b74af4b..263640ee0b 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 48; >+use Test::More tests => 47; > use Test::MockModule; > use Test::Deep qw( cmp_deeply ); > >@@ -2349,7 +2349,7 @@ subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub { > > > subtest 'AddReturn | is_overdue' => sub { >- plan tests => 7; >+ plan tests => 8; > > t::lib::Mocks::mock_preference('MarkLostItemsAsReturned', 'batchmod|moredetail|cronjob|additem|pendingreserves|onpayment'); > t::lib::Mocks::mock_preference('CalculateFinesOnReturn', 1); >@@ -2570,6 +2570,97 @@ subtest 'AddReturn | is_overdue' => sub { > AddReturn( $item->{barcode}, $library->{branchcode}, 1, $one_day_ago ); > is( int( $patron->account->balance() ), > 0, "Overdue fine should be annulled" ); >+ >+ # Cleanup >+ Koha::Account::Lines->search({ borrowernumber => $patron->borrowernumber })->delete; >+ }; >+ >+ subtest 'bug 24075 | backdated return with return datetime matching due datetime' => sub { >+ plan tests => 7; >+ >+ t::lib::Mocks::mock_preference( 'CalculateFinesOnBackdate', 1 ); >+ >+ my $due_date = dt_from_string; >+ my $issue = AddIssue( $patron->unblessed, $item->{barcode}, $due_date ); >+ >+ # Add fine >+ UpdateFine( >+ { >+ issue_id => $issue->issue_id, >+ itemnumber => $item->{itemnumber}, >+ borrowernumber => $patron->borrowernumber, >+ amount => 0.25, >+ due => output_pref($due_date) >+ } >+ ); >+ is( $patron->account->balance(), >+ 0.25, 'Overdue fine of $0.25 recorded' ); >+ >+ # Backdate return to exact due date and time >+ my ( undef, $message ) = >+ AddReturn( $item->{barcode}, $library->{branchcode}, >+ undef, $due_date ); >+ >+ my $accountline = >+ Koha::Account::Lines->find( { issue_id => $issue->id } ); >+ ok( !$accountline, 'accountline removed as expected' ); >+ >+ # Re-issue >+ $issue = AddIssue( $patron->unblessed, $item->{barcode}, $due_date ); >+ >+ # Add fine >+ UpdateFine( >+ { >+ issue_id => $issue->issue_id, >+ itemnumber => $item->{itemnumber}, >+ borrowernumber => $patron->borrowernumber, >+ amount => .25, >+ due => output_pref($due_date) >+ } >+ ); >+ is( $patron->account->balance(), >+ 0.25, 'Overdue fine of $0.25 recorded' ); >+ >+ # Partial pay accruing fine >+ my $lines = Koha::Account::Lines->search( >+ { >+ borrowernumber => $patron->borrowernumber, >+ issue_id => $issue->id >+ } >+ ); >+ my $debit = $lines->next; >+ my $credit = $patron->account->add_credit( >+ { >+ amount => .20, >+ type => 'PAYMENT', >+ interface => 'test', >+ } >+ ); >+ $credit->apply( { debits => [$debit], offset_type => 'Payment' } ); >+ >+ is( $patron->account->balance(), .05, 'Overdue fine reduced to $0.05' ); >+ >+ # Backdate return to exact due date and time >+ ( undef, $message ) = >+ AddReturn( $item->{barcode}, $library->{branchcode}, >+ undef, $due_date ); >+ >+ $lines = Koha::Account::Lines->search( >+ { >+ borrowernumber => $patron->borrowernumber, >+ issue_id => $issue->id >+ } >+ ); >+ my $accountline = $lines->next; >+ is( $accountline->amountoutstanding + 0, >+ 0, 'Partially paid fee amount outstanding was reduced to 0' ); >+ is( $accountline->amount + 0, >+ 0, 'Partially paid fee amount was reduced to 0' ); >+ is( $patron->account->balance(), -0.20, 'Patron refund recorded' ); >+ >+ # Cleanup >+ Koha::Account::Lines->search( >+ { borrowernumber => $patron->borrowernumber } )->delete; > }; > }; > >@@ -3886,49 +3977,6 @@ subtest 'CanBookBeIssued & RentalFeesCheckoutConfirmation' => sub { > $itemtype->rentalcharge_daily('0')->store; > }; > >-subtest "Test Backdating of Returns" => sub { >- plan tests => 2; >- >- my $branch = $library2->{branchcode}; >- my $biblio = $builder->build_sample_biblio(); >- my $item = $builder->build_sample_item( >- { >- biblionumber => $biblio->biblionumber, >- library => $branch, >- itype => $itemtype, >- } >- ); >- >- my %a_borrower_data = ( >- firstname => 'Kyle', >- surname => 'Hall', >- categorycode => $patron_category->{categorycode}, >- branchcode => $branch, >- ); >- my $borrowernumber = Koha::Patron->new(\%a_borrower_data)->store->borrowernumber; >- my $borrower = Koha::Patrons->find( $borrowernumber )->unblessed; >- >- my $due_date = dt_from_string; >- my $issue = AddIssue( $borrower, $item->barcode, $due_date ); >- UpdateFine( >- { >- issue_id => $issue->id(), >- itemnumber => $item->itemnumber, >- borrowernumber => $borrowernumber, >- amount => .25, >- amountoutstanding => .25, >- type => q{} >- } >- ); >- >- >- my ( undef, $message ) = AddReturn( $item->barcode, $branch, undef, $due_date ); >- >- my $accountline = Koha::Account::Lines->find( { issue_id => $issue->id } ); >- is( $accountline->amountoutstanding+0, 0, 'Fee amount outstanding was reduced to 0' ); >- is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' ); >-}; >- > subtest 'Do not return on renewal (LOST charge)' => sub { > plan tests => 1; > >-- >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 8338
:
104841
|
104842
|
104900
|
104901
|
105496
|
105497
|
105498
|
106152
|
106153
|
106154
|
106155
|
106209
|
106523
|
106524
| 106525 |
106526
|
106527
|
107140
|
110640