From b743b4ae9a306b35a22a53a7776904e61ae82401 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 24 Feb 2023 14:43:18 -0300 Subject: [PATCH] Bug 33054: Fix unit tests This patch fixes the tests by making sure: - The branch in userenv matches the home/holding branch so there are no circ rules getting in the middle - Gives the user superlibrarian permissions for the same reasons above. To test: 1. Run: $ ktd --shell k$ for i in $(seq 1 20 ); do prove t/db_dependent/Koha/Acquisition/Order.t ; done => FAIL: Notice it fails quite often. You can ctrl+c to interrupt once it has failed at least once. 2. Apply this patch 3. Repeat 1 => SUCCESS: it doesn't fail a single time 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/Koha/Acquisition/Order.t | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Acquisition/Order.t b/t/db_dependent/Koha/Acquisition/Order.t index bc5aa7ec325..4d96e3b7d93 100755 --- a/t/db_dependent/Koha/Acquisition/Order.t +++ b/t/db_dependent/Koha/Acquisition/Order.t @@ -654,7 +654,12 @@ subtest 'cancel() tests' => sub { ); $order->add_item( $item->id ); - my $patron = $builder->build_object({ class => 'Koha::Patrons' }); + my $patron = $builder->build_object( + { + class => 'Koha::Patrons', + value => { branchcode => $item->homebranch, flags => 1 } + } + ); t::lib::Mocks::mock_userenv({ patron => $patron }); # Add a checkout so deleting the item fails because od 'book_on_loan' -- 2.34.1