From 16158e64d6defbde64ddf68718da09f863a076f8 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 7 May 2024 19:06:53 +0100 Subject: [PATCH] Bug 33260: Tidy unit test Signed-off-by: Martin Renvoize --- t/db_dependent/Koha/Notice/Message.t | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/t/db_dependent/Koha/Notice/Message.t b/t/db_dependent/Koha/Notice/Message.t index a32d94e0a34..3eed09ce1b7 100755 --- a/t/db_dependent/Koha/Notice/Message.t +++ b/t/db_dependent/Koha/Notice/Message.t @@ -268,12 +268,18 @@ subtest 'search_limited' => sub { my $group_1 = Koha::Library::Group->new( { title => 'TEST Group 1' } )->store; my $group_2 = Koha::Library::Group->new( { title => 'TEST Group 2' } )->store; - Koha::Library::Group->new({ parent_id => $group_1->id, branchcode => $patron->branchcode })->store(); - Koha::Library::Group->new({ parent_id => $group_2->id, branchcode => $patron_2->branchcode })->store(); - t::lib::Mocks::mock_userenv( { patron => $patron } ); # Is superlibrarian - is( Koha::Notice::Messages->search_limited->count, $nb_messages, 'Koha::Notice::Messages->search_limited should return all generated notices for superlibrarian' ); - t::lib::Mocks::mock_userenv( { patron => $patron_2 } ); # Is restricted - is( Koha::Notice::Messages->search_limited->count, 1, 'Koha:Notice::Messages->search_limited should not return all generated notices for restricted patron' ); + Koha::Library::Group->new( { parent_id => $group_1->id, branchcode => $patron->branchcode } )->store(); + Koha::Library::Group->new( { parent_id => $group_2->id, branchcode => $patron_2->branchcode } )->store(); + t::lib::Mocks::mock_userenv( { patron => $patron } ); # Is superlibrarian + is( + Koha::Notice::Messages->search_limited->count, $nb_messages, + 'Koha::Notice::Messages->search_limited should return all generated notices for superlibrarian' + ); + t::lib::Mocks::mock_userenv( { patron => $patron_2 } ); # Is restricted + is( + Koha::Notice::Messages->search_limited->count, 1, + 'Koha:Notice::Messages->search_limited should not return all generated notices for restricted patron' + ); }; 1; -- 2.45.0