From b7a248ab5dbb98bae08ccf7e27d3d6cb947ef48e Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 7 Apr 2021 12:10:38 +0100 Subject: [PATCH] Bug 28097: Mock finesModes to disable recalculation Since bug 8338 the recalcuated zero amount fine is subsequently removed in _FixOverduesOnReturn which causes this test to fail if finesMode is 'production' and 'CalculateFinesOnReturn' is enabled. Perhaps we should be 'VOID'ing fines rather than completely deleting them, but that's a question for another day. Test plan 1/ Enable finesMode in the staff client 2/ Run the test and watch it fail 3/ Apply the patch 4/ Run the test and watch it pass Signed-off-by: Nick Clemens --- t/db_dependent/Koha/Account/Line.t | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/t/db_dependent/Koha/Account/Line.t b/t/db_dependent/Koha/Account/Line.t index 4a18526dac..d112b31906 100755 --- a/t/db_dependent/Koha/Account/Line.t +++ b/t/db_dependent/Koha/Account/Line.t @@ -594,12 +594,17 @@ subtest 'checkout() tests' => sub { item_id => $item->itemnumber, issue_id => $checkout->issue_id, type => 'OVERDUE', + status => 'UNRETURNED' }); my $line_checkout = $line->checkout; is( ref($line_checkout), 'Koha::Checkout', 'Result type is correct' ); is( $line_checkout->issue_id, $checkout->issue_id, 'Koha::Account::Line->checkout should return the correct checkout'); + # Prevent re-calculation of fines at check-in for the test; Since bug 8338 the recalculation would result in a '0' + # fine which would subsequently be removed by _FixOverduesOnReturn + t::lib::Mocks::mock_preference( 'finesMode', 'off' ); + my ( $returned, undef, $old_checkout) = C4::Circulation::AddReturn( $item->barcode, $library->branchcode ); is( $returned, 1, 'The item should have been returned' ); -- 2.11.0