From 191f0555a3f902979b73eb914ca0f62c0bcc8783 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 25 Nov 2022 08:13:04 +0000 Subject: [PATCH] Bug 32304: Fix subtest search_limited Jenkins reported: not ok 1 - No jobs found without userenv We need to check if there are jobs without borrowernumber. Test plan: Run test again. Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize --- t/db_dependent/Koha/BackgroundJobs.t | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/BackgroundJobs.t b/t/db_dependent/Koha/BackgroundJobs.t index ed4fd8d9fb..158565df4c 100755 --- a/t/db_dependent/Koha/BackgroundJobs.t +++ b/t/db_dependent/Koha/BackgroundJobs.t @@ -131,8 +131,10 @@ subtest 'search_limited' => sub { my $patron2 = $builder->build_object( { class => 'Koha::Patrons', value => { flags => 0 } } ); my $job1 = $builder->build_object( { class => 'Koha::BackgroundJobs', value => { borrowernumber => $patron1->id } } ); + my $cnt = Koha::BackgroundJobs->search({ borrowernumber => undef })->count; # expected to be zero, but theoretically possible + C4::Context->set_userenv( undef, q{} ); - is( Koha::BackgroundJobs->search_limited->count, 0, 'No jobs found without userenv' ); + is( Koha::BackgroundJobs->search_limited->count, $cnt, 'No jobs found without userenv' ); C4::Context->set_userenv( $patron1->id, $patron1->userid ); is( Koha::BackgroundJobs->search_limited->count, 1, 'My job found' ); C4::Context->set_userenv( $patron2->id, $patron2->userid ); -- 2.20.1