use t::lib::Mocks;
use t::lib::TestBuilder;
+use t::lib::Dates;
use Time::Fake;
-use C4::Calendar;
+use C4::Calendar qw( new insert_week_day_holiday delete_holiday );
use Koha::DateUtils qw(dt_from_string);
BEGIN {
to_date => $dt_to,
}
);
- is( $fees->from_date, dt_from_string(),
+ is( t::lib::Dates::compare($fees->from_date, dt_from_string()), 0,
'from_date default set correctly to today' );
};
}
);
- t::lib::Mocks::mock_preference( 'finesCalendar', 'ignoreCalendar' );
+ $itemtype->rentalcharge_hourly_calendar(0)->store();
$charge = $fees->accumulate_rentalcharge();
is( $charge, 24.00, 'Hourly rental charge calculated correctly (96h * 0.25u)' );
- t::lib::Mocks::mock_preference( 'finesCalendar', 'noFinesWhenClosed' );
+ $itemtype->rentalcharge_hourly_calendar(1)->store();
$charge = $fees->accumulate_rentalcharge();
is( $charge, 18.00,
"Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $dayname (96h - 24h * 0.25u)"
is( $charge, 24.00,
"Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $dayname (96h - 24h * 0.25u) and rentalcharge_hourly_calendar = 0"
);
- $itemtype->rentalcharge_hourly_calendar(1)->store();
+ $itemtype->rentalcharge_hourly_calendar(1)->store();
$calendar->delete_holiday( weekday => $closed_day );
$charge = $fees->accumulate_rentalcharge();
is( $charge, 24.00, 'Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed (96h - 0h * 0.25u)' );