Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 13; |
22 |
use Test::More tests => 14; |
23 |
use Test::MockModule; |
23 |
use Test::MockModule; |
24 |
|
24 |
|
25 |
use List::MoreUtils qw(any); |
25 |
use List::MoreUtils qw(any); |
Lines 122-124
subtest 'filter_by_current() tests' => sub {
Link Here
|
122 |
|
122 |
|
123 |
$schema->storage->txn_rollback; |
123 |
$schema->storage->txn_rollback; |
124 |
}; |
124 |
}; |
125 |
- |
125 |
|
|
|
126 |
subtest 'search_limited' => sub { |
127 |
plan tests => 3; |
128 |
|
129 |
$schema->storage->txn_begin; |
130 |
my $patron1 = $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 } } ); |
133 |
|
134 |
C4::Context->set_userenv( undef, q{} ); |
135 |
is( Koha::BackgroundJobs->search_limited->count, 0, 'No jobs found without userenv' ); |
136 |
C4::Context->set_userenv( $patron1->id, $patron1->userid ); |
137 |
is( Koha::BackgroundJobs->search_limited->count, 1, 'My job found' ); |
138 |
C4::Context->set_userenv( $patron2->id, $patron2->userid ); |
139 |
is( Koha::BackgroundJobs->search_limited->count, 0, 'No jobs for me' ); |
140 |
|
141 |
$schema->storage->txn_rollback; |
142 |
}; |