View | Details | Raw Unified | Return to bug 33260
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Notice/Message.t (-8 / +13 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 3;
22
use Test::More tests => 4;
23
23
24
use C4::Letters qw( GetPreparedLetter EnqueueLetter );
24
use C4::Letters qw( GetPreparedLetter EnqueueLetter );
25
25
Lines 265-276 subtest 'search_limited' => sub { Link Here
265
265
266
    my $group_1 = Koha::Library::Group->new( { title => 'TEST Group 1' } )->store;
266
    my $group_1 = Koha::Library::Group->new( { title => 'TEST Group 1' } )->store;
267
    my $group_2 = Koha::Library::Group->new( { title => 'TEST Group 2' } )->store;
267
    my $group_2 = Koha::Library::Group->new( { title => 'TEST Group 2' } )->store;
268
    Koha::Library::Group->new({ parent_id => $group_1->id,  branchcode => $patron->branchcode })->store();
268
    Koha::Library::Group->new( { parent_id => $group_1->id, branchcode => $patron->branchcode } )->store();
269
    Koha::Library::Group->new({ parent_id => $group_2->id,  branchcode => $patron_2->branchcode })->store();
269
    Koha::Library::Group->new( { parent_id => $group_2->id, branchcode => $patron_2->branchcode } )->store();
270
    t::lib::Mocks::mock_userenv( { patron => $patron } ); # Is superlibrarian
270
    t::lib::Mocks::mock_userenv( { patron => $patron } );    # Is superlibrarian
271
    is( Koha::Notice::Messages->search_limited->count, $nb_messages, 'Koha::Notice::Messages->search_limited should return all generated notices for superlibrarian' );
271
    is(
272
    t::lib::Mocks::mock_userenv( { patron => $patron_2 } ); # Is restricted
272
        Koha::Notice::Messages->search_limited->count, $nb_messages,
273
    is( Koha::Notice::Messages->search_limited->count, 1, 'Koha:Notice::Messages->search_limited should not return all generated notices for restricted patron' );
273
        'Koha::Notice::Messages->search_limited should return all generated notices for superlibrarian'
274
    );
275
    t::lib::Mocks::mock_userenv( { patron => $patron_2 } );    # Is restricted
276
    is(
277
        Koha::Notice::Messages->search_limited->count, 1,
278
        'Koha:Notice::Messages->search_limited should not return all generated notices for restricted patron'
279
    );
274
};
280
};
275
281
276
1;
282
1;
277
- 

Return to bug 33260