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 <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Marcel de Rooy 2022-11-25 08:13:04 +00:00 committed by Tomas Cohen Arazi
parent 509ff8f05c
commit 0a1d7aa520
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

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