From 1364c85fc5b214563783bd2490c01675a2468a4a 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 | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/t/db_dependent/Koha/Notice/Message.t b/t/db_dependent/Koha/Notice/Message.t index 0c6a1f84781..ee4f80ef30d 100755 --- a/t/db_dependent/Koha/Notice/Message.t +++ b/t/db_dependent/Koha/Notice/Message.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 3; +use Test::More tests => 4; use C4::Letters qw( GetPreparedLetter EnqueueLetter ); @@ -265,12 +265,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.46.2