Bug 17600: Standardize our EXPORT_OK
[srvgit] / t / db_dependent / Koha / Charges / Fees.t
old mode 100644 (file)
new mode 100755 (executable)
index a28cc48..2f2af9d
@@ -25,9 +25,10 @@ use Test::Warn;
 
 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 {
@@ -198,7 +199,7 @@ subtest 'new' => sub {
             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' );
 };
 
@@ -408,11 +409,11 @@ subtest 'accumulate_rentalcharge tests' => sub {
         }
     );
 
-    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)"
@@ -423,8 +424,8 @@ subtest 'accumulate_rentalcharge tests' => sub {
     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)' );