From cf5c33077e331dcd7a2f29a4373feca0a8e7c74a Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 17 Jan 2014 09:05:40 -0500 Subject: [PATCH] [PASSED QA] Bug 10452 [QA Followup] - Unit tests Signed-off-by: Katrin Fischer Passes all tests and QA script. Also checked t/db_dependent/Holds.t t/db_dependent/HoldsQueue.t Tested holds triggering with different settings of AllowHoldsOnDamagedItems. Works as described. --- t/db_dependent/Holds.t | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t index 2c28c07..2e0d278 100755 --- a/t/db_dependent/Holds.t +++ b/t/db_dependent/Holds.t @@ -6,7 +6,7 @@ use t::lib::Mocks; use C4::Context; use C4::Branch; -use Test::More tests => 25; +use Test::More tests => 29; use MARC::Record; use C4::Biblio; use C4::Items; @@ -278,6 +278,14 @@ ModReserve({ reserve_id => $reserveid2, rank => 'del' }); $reserve3 = GetReserve( $reserveid3 ); is( $reserve3->{priority}, 1, "After ModReserve, the 3rd reserve becomes the first on the waiting list" ); +ModItem({ damaged => 1 }, $item_bibnum, $itemnumber); +C4::Context->set_preference( 'AllowHoldsOnDamagedItems', 1 ); +ok( CanItemBeReserved( $borrowernumbers[0], $itemnumber), "Patron can reserve damaged item with AllowHoldsOnDamagedItems enabled" ); +ok( defined( ( CheckReserves($itemnumber) )[1] ), "Hold can be trapped for damaged item with AllowHoldsOnDamagedItems enabled" ); +C4::Context->set_preference( 'AllowHoldsOnDamagedItems', 0 ); +ok( !CanItemBeReserved( $borrowernumbers[0], $itemnumber), "Patron cannot reserve damaged item with AllowHoldsOnDamagedItems disabled" ); +ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" ); + # Helper method to set up a Biblio. sub create_helper_biblio { -- 1.8.3.2