Lines 338-351
subtest 'accumulate_rentalcharge tests' => sub {
Link Here
|
338 |
); |
338 |
); |
339 |
|
339 |
|
340 |
my $calendar = C4::Calendar->new( branchcode => $library->id ); |
340 |
my $calendar = C4::Calendar->new( branchcode => $library->id ); |
|
|
341 |
my $day = $dt_from->day_of_week + 1; |
341 |
$calendar->insert_week_day_holiday( |
342 |
$calendar->insert_week_day_holiday( |
342 |
weekday => 3, |
343 |
weekday => $day, |
343 |
title => 'Test holiday', |
344 |
title => 'Test holiday', |
344 |
description => 'Test holiday' |
345 |
description => 'Test holiday' |
345 |
); |
346 |
); |
346 |
$charge = $fees->accumulate_rentalcharge(); |
347 |
$charge = $fees->accumulate_rentalcharge(); |
|
|
348 |
my $dayname = $dt_from->clone->add( days => 1 )->day_name; |
347 |
is( $charge, 5.00, |
349 |
is( $charge, 5.00, |
348 |
'Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays' |
350 |
"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $dayname" |
349 |
); |
351 |
); |
350 |
|
352 |
|
351 |
# Hourly tests |
353 |
# Hourly tests |
Lines 379-388
subtest 'accumulate_rentalcharge tests' => sub {
Link Here
|
379 |
t::lib::Mocks::mock_preference( 'finesCalendar', 'noFinesWhenClosed' ); |
381 |
t::lib::Mocks::mock_preference( 'finesCalendar', 'noFinesWhenClosed' ); |
380 |
$charge = $fees->accumulate_rentalcharge(); |
382 |
$charge = $fees->accumulate_rentalcharge(); |
381 |
is( $charge, 18.00, |
383 |
is( $charge, 18.00, |
382 |
'Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays (96h - 24h * 0.25u)' |
384 |
"Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $dayname (96h - 24h * 0.25u)" |
383 |
); |
385 |
); |
384 |
|
386 |
|
385 |
$calendar->delete_holiday( weekday => 3); |
387 |
$calendar->delete_holiday( weekday => $day ); |
386 |
$charge = $fees->accumulate_rentalcharge(); |
388 |
$charge = $fees->accumulate_rentalcharge(); |
387 |
is( $charge, 24.00, 'Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed (96h - 0h * 0.25u)' ); |
389 |
is( $charge, 24.00, 'Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed (96h - 0h * 0.25u)' ); |
388 |
}; |
390 |
}; |
389 |
- |
|
|