From fc10a40a952d67ff892337f3a464280514845526 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 25 Feb 2022 08:53:11 +0000 Subject: [PATCH] Bug 19532: (QA follow-up) Fixing unit tests (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 eef6c266eb7..2d4d50da3d4 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 c1de0d0d684..6b645b5b52f 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 00d70e01874..b95057812ea 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.11.0