From 9f15b402e74a163b3e78db044f542792de603a54 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Thu, 30 Jan 2020 15:38:26 +0100
Subject: [PATCH] Bug 24546: Fix intentions of build_sample_item in Club/Hold.t

In t/db_dependent/Koha/Club/Hold.t:
my $item1 = $builder->build_sample_item({ branchcode => $library->branchcode });
my $item2 = $builder->build_sample_item({ branchcode => $library->branchcode });

build_sample_item takes either "library" or the item's attributes.
branchcode is not part of the item's table, so what those 2 lines are trying to acchieve is wrong.

Test plan:
 % prove t/db_dependent/Koha/Club/Hold.t
must return green before and after this patch

Note that this patch also remove an uneeded debugging statement.

This has been caught by bug 24363.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
---
 t/db_dependent/Koha/Club/Hold.t | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/t/db_dependent/Koha/Club/Hold.t b/t/db_dependent/Koha/Club/Hold.t
index b672f1cacd..6aee1e4dcf 100644
--- a/t/db_dependent/Koha/Club/Hold.t
+++ b/t/db_dependent/Koha/Club/Hold.t
@@ -42,10 +42,9 @@ subtest 'add' => sub {
 
     my $club = $builder->build_object({ class => 'Koha::Clubs' });
     my $library = $builder->build_object({ class => 'Koha::Libraries' });
-    my $item1 = $builder->build_sample_item({ branchcode => $library->branchcode });
-    my $item2 = $builder->build_sample_item({ branchcode => $library->branchcode });
+    my $item1 = $builder->build_sample_item({ library => $library->branchcode });
+    my $item2 = $builder->build_sample_item({ library => $library->branchcode });
 
-    use Data::Printer colored => 1;
     try {
         Koha::Club::Hold::add({ club_id => $club->id, biblio_id => $item1->biblionumber, pickup_library_id => $library->branchcode });
     } catch {
@@ -84,4 +83,4 @@ subtest 'add' => sub {
     is($patron_hold->patron_id, $hold->borrowernumber, 'Patron must be the same');
 
     $schema->storage->txn_rollback;
-}
\ No newline at end of file
+}
-- 
2.25.0