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 <martin.renvoize@openfifth.co.uk>
(cherry picked from commit b0df04264e)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-03-26 09:30:23 +01:00 committed by Jacob O'Mara
parent fa67c646a9
commit 9cd18e379b
No known key found for this signature in database
1 changed files with 3 additions and 3 deletions

View File

@ -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' );
};