From f8212df2afa8105e17722a74f097244ed585eb6e Mon Sep 17 00:00:00 2001
From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Date: Fri, 25 Feb 2022 08:53:11 +0000
Subject: [PATCH] Bug 19532: (QA follow-up) Fixing unit tests
Content-Type: text/plain; charset=utf-8

(Trivial:) Number of tests in Koha/Item.t
Added a $patron object to resolve warnings like:
* Global symbol "$patron" requires explicit package name (did you forget to declare "my $patron"?) at t/db_dependent/Koha/Patron.t line 1064.
Fixed CanItemBeReserved call in Holds.t, number of tests adjusted
---
 t/db_dependent/Holds.t       | 4 ++--
 t/db_dependent/Koha/Item.t   | 2 +-
 t/db_dependent/Koha/Patron.t | 1 +
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t
index eef6c266eb..2d4d50da3d 100755
--- a/t/db_dependent/Holds.t
+++ b/t/db_dependent/Holds.t
@@ -7,7 +7,7 @@ use t::lib::TestBuilder;
 
 use C4::Context;
 
-use Test::More tests => 73;
+use Test::More tests => 74;
 use Test::Exception;
 
 use MARC::Record;
@@ -1574,7 +1574,7 @@ subtest 'CanItemBeReserved / recall' => sub {
         recalldate => '2020-05-04 10:10:10',
         item_level_recall => 1,
     })->store;
-    is( CanItemBeReserved( $patron1->borrowernumber, $item1->itemnumber, $library1->branchcode )->{status}, 'recall', "Can't reserve an item that they have already recalled" );
+    is( CanItemBeReserved( $patron1, $item1, $library1->branchcode )->{status}, 'recall', "Can't reserve an item that they have already recalled" );
 
     $schema->storage->txn_rollback;
 };
diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t
index c1de0d0d68..6b645b5b52 100755
--- a/t/db_dependent/Koha/Item.t
+++ b/t/db_dependent/Koha/Item.t
@@ -20,7 +20,7 @@
 use Modern::Perl;
 use utf8;
 
-use Test::More tests => 14;
+use Test::More tests => 15;
 use Test::Exception;
 
 use C4::Biblio qw( GetMarcSubfieldStructure );
diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t
index 00d70e0187..b95057812e 100755
--- a/t/db_dependent/Koha/Patron.t
+++ b/t/db_dependent/Koha/Patron.t
@@ -1054,6 +1054,7 @@ subtest 'messages' => sub {
 subtest 'recalls() tests' => sub {
 
     plan tests => 2;
+    my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
     my $biblio1 = $builder->build_object({ class => 'Koha::Biblios' });
     my $item1 = $builder->build_object({ class => 'Koha::Items' }, { value => { biblionumber => $biblio1->biblionumber } });
     my $biblio2 = $builder->build_object({ class => 'Koha::Biblios' });
-- 
2.20.1