From 793aefb04b7968c6a0253c79c5adfead36c8b89d Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 27 Sep 2023 10:43:04 +0000 Subject: [PATCH] Bug 34918: Fix userenv for safe_to_delete tests Instead of the fallback to 51, we pass a borrower that has permission for editing items. Test plan: Do not apply patch. Run test without a borrower 51 in db. (FAIL) Apply patch. Run test again. (PASS) Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer --- t/db_dependent/Koha/Item.t | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index 28a723e49c..d30ea6d54b 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -869,9 +869,10 @@ subtest 'deletion' => sub { my $library = $builder->build_object({ class => 'Koha::Libraries' }); my $library_2 = $builder->build_object({ class => 'Koha::Libraries' }); - t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode }); - my $patron = $builder->build_object({class => 'Koha::Patrons'}); + my $patron = $builder->build_object({class => 'Koha::Patrons', value => { flags => 2^9 } }); # allow edit items + t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode, borrowernumber => $patron->id }); + $item = $builder->build_sample_item({ library => $library->branchcode }); # book_on_loan -- 2.30.2