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>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2020-01-30 15:38:26 +01:00 committed by Joy Nelson
parent a27c5c9dcd
commit 29cabac319
1 changed files with 3 additions and 4 deletions

View File

@ -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;
}
}