From 9cd18e379bb63b64242f6c5ebc2214fd7e1c19e2 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 26 Mar 2026 09:30:23 +0100 Subject: [PATCH] Bug 39781: (RM follow-up) Fix wrong mock_userenv key in test mock_userenv expects 'branchcode' but the test was passing 'branch', causing the branchcode to fall through to the 'Branch4T' default and the branch-specific notice lookup to never match. Signed-off-by: Martin Renvoize (cherry picked from commit b0df04264e857d1993f8af2d7c64e8b01f17ce0d) Signed-off-by: Jacob O'Mara --- t/db_dependent/Template/Plugin/NoticeTemplates.t | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/Template/Plugin/NoticeTemplates.t b/t/db_dependent/Template/Plugin/NoticeTemplates.t index 20b299cb60..fb47924262 100755 --- a/t/db_dependent/Template/Plugin/NoticeTemplates.t +++ b/t/db_dependent/Template/Plugin/NoticeTemplates.t @@ -90,15 +90,15 @@ subtest 'GetByModuleForLibrary' => sub { $builder->build( { source => 'Letter', value => { module => 'add_message', code => 'MSG_BRANCH1', branchcode => $branch1 } } ); - t::lib::Mocks::mock_userenv( { branch => $branch1 } ); + t::lib::Mocks::mock_userenv( { branchcode => $branch1 } ); $notices = $plugin->GetByModuleForLibrary('add_message'); is( scalar @$notices, 2, 'user at branch1 sees all-libraries and branch-specific notices' ); - t::lib::Mocks::mock_userenv( { branch => $branch2 } ); + t::lib::Mocks::mock_userenv( { branchcode => $branch2 } ); $notices = $plugin->GetByModuleForLibrary('add_message'); is( scalar @$notices, 1, 'user at branch2 sees only all-libraries notices' ); - t::lib::Mocks::mock_userenv( { branch => '' } ); + t::lib::Mocks::mock_userenv( { branchcode => $branch2 } ); $notices = $plugin->GetByModuleForLibrary('add_message'); is( scalar @$notices, 1, 'user with no branch sees only all-libraries notices' ); };