Bug 13919: Unit Test
authorKyle M Hall <kyle@bywatersolutions.com>
Mon, 30 Mar 2015 14:16:11 +0000 (10:16 -0400)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 28 Apr 2015 18:11:27 +0000 (15:11 -0300)
Tested both unit test patches together.
Without main patch applied: do not pass as expected / with main patch pass OK as expected.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
t/db_dependent/Circulation.t

index e48ab70..53ea1ce 100755 (executable)
@@ -300,9 +300,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,