Lines 131-138
subtest 'search_limited' => sub {
Link Here
|
131 |
my $patron2 = $builder->build_object( { class => 'Koha::Patrons', value => { flags => 0 } } ); |
131 |
my $patron2 = $builder->build_object( { class => 'Koha::Patrons', value => { flags => 0 } } ); |
132 |
my $job1 = $builder->build_object( { class => 'Koha::BackgroundJobs', value => { borrowernumber => $patron1->id } } ); |
132 |
my $job1 = $builder->build_object( { class => 'Koha::BackgroundJobs', value => { borrowernumber => $patron1->id } } ); |
133 |
|
133 |
|
|
|
134 |
my $cnt = Koha::BackgroundJobs->search({ borrowernumber => undef })->count; # expected to be zero, but theoretically possible |
135 |
|
134 |
C4::Context->set_userenv( undef, q{} ); |
136 |
C4::Context->set_userenv( undef, q{} ); |
135 |
is( Koha::BackgroundJobs->search_limited->count, 0, 'No jobs found without userenv' ); |
137 |
is( Koha::BackgroundJobs->search_limited->count, $cnt, 'No jobs found without userenv' ); |
136 |
C4::Context->set_userenv( $patron1->id, $patron1->userid ); |
138 |
C4::Context->set_userenv( $patron1->id, $patron1->userid ); |
137 |
is( Koha::BackgroundJobs->search_limited->count, 1, 'My job found' ); |
139 |
is( Koha::BackgroundJobs->search_limited->count, 1, 'My job found' ); |
138 |
C4::Context->set_userenv( $patron2->id, $patron2->userid ); |
140 |
C4::Context->set_userenv( $patron2->id, $patron2->userid ); |
139 |
- |
|
|