use Modern::Perl;
-use Test::More tests => 6;
+use Test::More tests => 7;
use Test::MockModule;
use DBI;
use DateTime;
t::lib::Mocks::mock_preference('ReturnBeforeExpiry', 1);
t::lib::Mocks::mock_preference('useDaysMode', 'Days');
+my $cache = Koha::Caches->get_instance();
+$cache->clear_from_cache('single_holidays');
+
my $dateexpiry = '2013-01-01';
my $borrower = {categorycode => 'B', dateexpiry => $dateexpiry};
);
$date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower );
is($date, '2012-12-31T23:59:00', 'date expiry should be 2013-01-01 -1 day');
+$calendar->insert_single_holiday(
+ day => 31,
+ month => 12,
+ year => 2012,
+ title =>'holidayTest',
+ description => 'holidayDesc'
+);
+$date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower );
+is($date, '2012-12-30T23:59:00', 'date expiry should be 2013-01-01 -2 day');
$date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower, 1 );
$date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower, 1 );
is($date, '2013-02-' . (9 + $renewalperiod) . 'T23:59:00', "date expiry ( 9 + $renewalperiod )");
+$cache->clear_from_cache('single_holidays');
$schema->storage->txn_rollback;