From 21f2ed6b198057217cdaadf7dd395618a1ac7458 Mon Sep 17 00:00:00 2001
From: Kyle M Hall <kyle@bywatersolutions.com>
Date: Fri, 16 Oct 2015 09:53:51 -0400
Subject: [PATCH] Bug 12803 [QA Followup] - Allow holiday caching to be disabled for testing purposes

---
 Koha/Calendar.pm            |    2 +-
 t/db_dependent/HoldsQueue.t |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm
index a0b642b..5904dee 100644
--- a/Koha/Calendar.pm
+++ b/Koha/Calendar.pm
@@ -104,7 +104,7 @@ sub single_holidays {
     #   ...
     # }
 
-    unless ($single_holidays) {
+    if (!$single_holidays || $ENV{NO_CACHE}) {
         my $dbh = C4::Context->dbh;
         $single_holidays = {};
 
diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t
index e87f309..dcabd8b 100755
--- a/t/db_dependent/HoldsQueue.t
+++ b/t/db_dependent/HoldsQueue.t
@@ -297,6 +297,7 @@ ok( $holds_queue->[1]->{cardnumber} eq 'CARDNUMBER2', "Holds queue filling 2nd c
 # and make today a holiday for MPL. When we run it again we should only
 # have 1 row in the holds queue
 C4::Context->set_preference('HoldsQueueSkipClosed', 1);
+$ENV{NO_CACHE} = 1;
 my $today = dt_from_string();
 C4::Calendar->new( branchcode => 'MPL' )->insert_single_holiday(
     day         => $today->day(),
@@ -325,6 +326,7 @@ C4::Context->set_preference( 'HoldsQueueSkipClosed', 1 );
 C4::HoldsQueue::CreateQueue();
 $holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
 is( scalar( @$holds_queue ), 2, "Holds not filled with items from closed libraries" );
+$ENV{NO_CACHE} = 0;
 
 # Bug 14297
 $borrowernumber = AddMember(%data);
-- 
1.7.2.5