Bug 39337: (follow-up) Mock OpacSuppression in Output tests

Before the refactoring in this bug, redirect_if_opac_suppressed was
intended to be called after checking OpacSuppression was enabled. Now
it performs this check internally, so to adapt these unit tests
correspondingly, we mock OpacSuppression to be enabled, as was the
implied state before.

Test plan:
1. Prove t/db_dependent/Output.t and verify all tests pass.

Sponsored-by: Open Fifth
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Olivia Reynolds 2026-09-16 09:51:28 +00:00 committed by Pedro Amorim
parent bb05ef7ce8
commit 0ae6c196ec
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 6 additions and 0 deletions

View File

@ -63,6 +63,8 @@ subtest 'redirect_if_opac_suppressed() tests' => sub {
plan tests => 1;
t::lib::Mocks::mock_preference( 'OpacSuppression', 1 );
open STDOUT, '>', \$stdout;
$opac_suppressed = 0;
@ -81,6 +83,7 @@ subtest 'redirect_if_opac_suppressed() tests' => sub {
{
open STDOUT, '>', \$stdout;
t::lib::Mocks::mock_preference( 'OpacSuppression', 1 );
t::lib::Mocks::mock_preference( 'OpacSuppressionByIPRange', undef );
t::lib::Mocks::mock_preference( 'OpacSuppressionRedirect', 1 );
@ -100,6 +103,7 @@ subtest 'redirect_if_opac_suppressed() tests' => sub {
{
open STDOUT, '>', \$stdout;
t::lib::Mocks::mock_preference( 'OpacSuppression', 1 );
t::lib::Mocks::mock_preference( 'OpacSuppressionByIPRange', undef );
t::lib::Mocks::mock_preference( 'OpacSuppressionRedirect', 0 );
@ -121,6 +125,7 @@ subtest 'redirect_if_opac_suppressed() tests' => sub {
{
open STDOUT, '>', \$stdout;
t::lib::Mocks::mock_preference( 'OpacSuppression', 1 );
t::lib::Mocks::mock_preference( 'OpacSuppressionByIPRange', '192.168' );
t::lib::Mocks::mock_preference( 'OpacSuppressionRedirect', 0 );
@ -143,6 +148,7 @@ subtest 'redirect_if_opac_suppressed() tests' => sub {
{
open STDOUT, '>', \$stdout;
t::lib::Mocks::mock_preference( 'OpacSuppression', 1 );
t::lib::Mocks::mock_preference( 'OpacSuppressionByIPRange', '192.168' );
t::lib::Mocks::mock_preference( 'OpacSuppressionRedirect', 0 );