Bug 23382: (follow-up) Ensure closed day is inside charge window
We're testing with an hourly loan of 96 hours to catch a closed day. However, our closed day was hard coded to be a Wednesday so if you ran the tests on a Friday the 96 hour loan would not catch a Wednesday. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
a693c7243c
commit
a5bf7b1e55
|
|
@ -338,14 +338,16 @@ subtest 'accumulate_rentalcharge tests' => sub {
|
|||
);
|
||||
|
||||
my $calendar = C4::Calendar->new( branchcode => $library->id );
|
||||
my $day = $dt_from->day_of_week + 1;
|
||||
$calendar->insert_week_day_holiday(
|
||||
weekday => 3,
|
||||
weekday => $day,
|
||||
title => 'Test holiday',
|
||||
description => 'Test holiday'
|
||||
);
|
||||
$charge = $fees->accumulate_rentalcharge();
|
||||
my $dayname = $dt_from->clone->add( days => 1 )->day_name;
|
||||
is( $charge, 5.00,
|
||||
'Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays'
|
||||
"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $dayname"
|
||||
);
|
||||
|
||||
# Hourly tests
|
||||
|
|
@ -379,10 +381,10 @@ subtest 'accumulate_rentalcharge tests' => sub {
|
|||
t::lib::Mocks::mock_preference( 'finesCalendar', 'noFinesWhenClosed' );
|
||||
$charge = $fees->accumulate_rentalcharge();
|
||||
is( $charge, 18.00,
|
||||
'Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays (96h - 24h * 0.25u)'
|
||||
"Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $dayname (96h - 24h * 0.25u)"
|
||||
);
|
||||
|
||||
$calendar->delete_holiday( weekday => 3);
|
||||
$calendar->delete_holiday( weekday => $day );
|
||||
$charge = $fees->accumulate_rentalcharge();
|
||||
is( $charge, 24.00, 'Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed (96h - 0h * 0.25u)' );
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue