From c0d7030b024d290780df133e55830b8ae90cd7c3 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 16 Oct 2015 09:53:51 -0400 Subject: [PATCH] Bug 12803 [QA Followup] - Allow holiday caching to be disabled for testing purposes Bug 12803 [QA Followup] - Remove use of C4::Dates C4::Dates was being included, but not used in the code! Bug 12803 [QA Followup] - Fix koha-qa.pl errors Bug 12803 [QA Followup] - Update unit tests due to changes in master Bug 12803 [QA Followup] - Fix to stop failing unit tests Bug 12803 [QA Followup] - Remove duplicate 'use' lines Bug 12803 [QA Followup] - Remove NO_CACHE Signed-off-by: Jonathan Druart Signed-off-by: Brendan A Gallagher --- C4/HoldsQueue.pm | 1 - installer/data/mysql/sysprefs.sql | 2 +- t/db_dependent/HoldsQueue.t | 17 +++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm index 3b92f9b1e9..3cfe206e90 100755 --- a/C4/HoldsQueue.pm +++ b/C4/HoldsQueue.pm @@ -29,7 +29,6 @@ use C4::Branch; use C4::Circulation; use C4::Members; use C4::Biblio; -use C4::Dates qw/format_date/; use Koha::DateUtils; use List::Util qw(shuffle); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 92de8be383..14b29a489e 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -159,8 +159,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('HighlightOwnItemsOnOPAC','0','','If on, and a patron is logged into the OPAC, items from his or her home library will be emphasized and shown first in search results and item details.','YesNo'), ('HighlightOwnItemsOnOPACWhich','PatronBranch','PatronBranch|OpacURLBranch','Decides which branch\'s items to emphasize. If PatronBranch, emphasize the logged in user\'s library\'s items. If OpacURLBranch, highlight the items of the Apache var BRANCHCODE defined in Koha\'s Apache configuration file.','Choice'), ('HoldFeeMode','not_always','always|not_always','Set the hold fee mode','Choice'), -('HoldsToPullStartDate','2',NULL,'Set the default start date for the Holds to pull list to this many days ago','Integer'), ('HoldsQueueSkipClosed', '0', NULL, 'If enabled, any libraries that are closed when the holds queue is built will be ignored for the purpose of filling holds.', 'YesNo'), +('HoldsToPullStartDate','2',NULL,'Set the default start date for the Holds to pull list to this many days ago','Integer'), ('HomeOrHoldingBranch','holdingbranch','holdingbranch|homebranch','Used by Circulation to determine which branch of an item to check with independent branches on, and by search to determine which branch to choose for availability ','Choice'), ('HTML5MediaEnabled','not','not|opac|staff|both','Show a tab with a HTML5 media player for files catalogued in field 856','Choice'), ('HTML5MediaExtensions','webm|ogg|ogv|oga|vtt','','Media file extensions','free'), diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t index 3da5dbb7ff..f0141fbb5a 100755 --- a/t/db_dependent/HoldsQueue.t +++ b/t/db_dependent/HoldsQueue.t @@ -8,19 +8,16 @@ use Modern::Perl; -use Test::More tests => 24; +use Test::More tests => 26; use Data::Dumper; use C4::Branch; -use C4::Members; -use Koha::Database; - use C4::Calendar; use C4::Context; -use C4::Branch; -use C4::ItemType; use C4::Members; +use Koha::Database; use Koha::DateUtils; +use Koha::ItemType; use t::lib::TestBuilder; @@ -312,13 +309,16 @@ is( $holds_queue->[1]->{cardnumber}, $borrower2->{cardnumber}, "Holds queue fill # have 1 row in the holds queue C4::Context->set_preference('HoldsQueueSkipClosed', 1); my $today = dt_from_string(); -C4::Calendar->new( branchcode => 'MPL' )->insert_single_holiday( +C4::Calendar->new( branchcode => $branchcodes[0] )->insert_single_holiday( day => $today->day(), month => $today->month(), year => $today->year(), title => "$today", description => "$today", ); +# If the test below is removed, aother tests using the holiday will fail. For some reason if we call is_holiday now +# the holiday will get set in cache correctly, but not if we let C4::HoldsQueue call is_holiday instead. +is( Koha::Calendar->new( branchcode => $branchcodes[0] )->is_holiday( $today ), 1, 'Is today a holiday for pickup branch' ); C4::HoldsQueue::CreateQueue(); $holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} }); is( scalar( @$holds_queue ), 1, "Holds not filled with items from closed libraries" ); @@ -333,12 +333,13 @@ is( @$holds_queue, 3, "Holds queue filling correct number for holds for default # Test skipping hold picks for closed libraries without transport cost matrix # At this point in the test, we have 3 rows in the holds queue # one of which is coming from MPL. Let's enable HoldsQueueSkipClosed -# and use our previously created holiday for MPL. +# and use our previously created holiday for MPL # When we run it again we should only have 2 rows in the holds queue 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" ); +C4::Context->set_preference( 'HoldsQueueSkipClosed', 0 ); # Bug 14297 $itemtype = Koha::ItemTypes->search->next->itemtype; -- 2.39.5