From e785da705f1c28d3a941983ccf0fd354f3a86f2f Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 30 Mar 2015 10:16:11 -0400 Subject: [PATCH] Bug 13919 - Unit Test --- t/db_dependent/Circulation.t | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 5b5a3e6..8037653 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -26,7 +26,7 @@ use C4::Reserves; use Koha::DateUtils; use Koha::Database; -use Test::More tests => 59; +use Test::More tests => 60; BEGIN { use_ok('C4::Circulation'); @@ -297,9 +297,24 @@ C4::Context->dbh->do("DELETE FROM accountlines"); is( $renewokay, 1, 'Bug 11634 - Allow renewal of item with unfilled holds if other available items can fill those holds'); ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber2); is( $renewokay, 1, 'Bug 11634 - Allow renewal of item with unfilled holds if other available items can fill those holds'); + + # Now let's add an item level hold, we should no longer be able to renew the item + my $hold = Koha::Database->new()->schema()->resultset('Reserve')->create( + { + borrowernumber => $hold_waiting_borrowernumber, + biblionumber => $biblionumber, + itemnumber => $itemnumber, + branchcode => $branch, + priority => 3, + } + ); + ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $itemnumber); + is( $renewokay, 0, 'Bug 13919 - Renewal possible with item level hold on item'); + $hold->delete(); + # Now let's add a waiting hold on the 3rd item, it's no longer available tp check out by just anyone, so we should no longer # be able to renew these items - my $hold = Koha::Database->new()->schema()->resultset('Reserve')->create( + $hold = Koha::Database->new()->schema()->resultset('Reserve')->create( { borrowernumber => $hold_waiting_borrowernumber, biblionumber => $biblionumber, -- 1.7.2.5