Browse Source

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 <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
master
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      t/db_dependent/Koha/Account/Line.t

+ 5
- 0
t/db_dependent/Koha/Account/Line.t View File

@@ -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' );



Loading…
Cancel
Save