From c24aec1cc2b8edb39e0e3bf58d10c95cb5768cc8 Mon Sep 17 00:00:00 2001
From: Shi Yao Wang <shi-yao.wang@inlibro.com>
Date: Mon, 4 Jul 2022 09:49:54 -0400
Subject: [PATCH] Bug 30556: (follow-up) Unit tests

Signed-off-by: David Nind <david@davidnind.com>
---
 t/db_dependent/Reserves.t | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t
index 3371c9539d..1f2952d4b6 100755
--- a/t/db_dependent/Reserves.t
+++ b/t/db_dependent/Reserves.t
@@ -1455,7 +1455,7 @@ $schema->storage->txn_rollback();
 
 subtest 'IsAvailableForItemLevelRequest() tests' => sub {
 
-    plan tests => 2;
+    plan tests => 3;
 
     $schema->storage->txn_begin;
 
@@ -1487,6 +1487,11 @@ subtest 'IsAvailableForItemLevelRequest() tests' => sub {
         "Item not available for item-level hold because no effective item type"
     );
 
+    ok(
+        !C4::Reserves::IsAvailableForItemLevelRequest( $item, undef ),
+        "Item not available for item-level hold because no patron defined"
+    );
+
     $schema->storage->txn_rollback;
 };
 
@@ -1594,7 +1599,7 @@ subtest 'AlterPriorty() tests' => sub {
 
 subtest 'CanBookBeReserved() tests' => sub {
 
-    plan tests => 2;
+    plan tests => 3;
 
     $schema->storage->txn_begin;
 
@@ -1665,6 +1670,10 @@ subtest 'CanBookBeReserved() tests' => sub {
         { itemtype => $itype->id } );
     is_deeply( $res, { status => '' }, 'Holds on itemtype limit reached' );
 
+    $res = CanBookBeReserved( undef, $biblio->id, $library->id,
+        { itemtype => $itype->id } );
+    is_deeply( $res, { status => '' }, 'Patron id undefined' );
+
     $schema->storage->txn_rollback;
 };
 
-- 
2.30.2