From 0fc023318370dd2ccc4d97213b4825afe7ec09e3 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Tue, 26 Sep 2023 14:42:08 +0000 Subject: [PATCH] Bug 34918: Fix hardcoded borrowernumber 42 Test plan: Run t/db_dependent/Koha/Item.t Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer --- t/db_dependent/Koha/Item.t | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index 9552eb8adf..28a723e49c 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -361,7 +361,11 @@ subtest 'has_pending_hold() tests' => sub { my $item = $builder->build_sample_item({ itemlost => 0 }); my $itemnumber = $item->itemnumber; - $dbh->do("INSERT INTO tmp_holdsqueue (surname,borrowernumber,itemnumber) VALUES ('Clamp',42,$itemnumber)"); + my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); + my $borrowernumber = $patron->id; + + $dbh->do( + "INSERT INTO tmp_holdsqueue (surname,borrowernumber,itemnumber) VALUES ('Clamp',$borrowernumber,$itemnumber)"); ok( $item->has_pending_hold, "Yes, we have a pending hold"); $dbh->do("DELETE FROM tmp_holdsqueue WHERE itemnumber=$itemnumber"); $item->discard_changes; -- 2.30.2