From daeb5cf5154a9fa03911f7359d5cb6446b379a13 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 6 Sep 2017 12:52:46 -0300 Subject: [PATCH] Bug 11580: Add one more test and clear the cache Make sure we are not just returning J-1 and clear the cache before and after the tests. --- t/db_dependent/Circulation/CalcDateDue.t | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Circulation/CalcDateDue.t b/t/db_dependent/Circulation/CalcDateDue.t index 98efd48..c6b6b52 100644 --- a/t/db_dependent/Circulation/CalcDateDue.t +++ b/t/db_dependent/Circulation/CalcDateDue.t @@ -2,7 +2,7 @@ use Modern::Perl; -use Test::More tests => 6; +use Test::More tests => 7; use Test::MockModule; use DBI; use DateTime; @@ -36,6 +36,9 @@ Koha::Database->schema->resultset('Issuingrule')->create({ 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}; @@ -66,6 +69,15 @@ $calendar->insert_single_holiday( ); $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 ); @@ -83,4 +95,5 @@ is($date, '2013-02-' . (9 + $issuelength) . 'T23:59:00', "date expiry ( 9 + $iss $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; -- 2.1.4