Lines 61-84
subtest 'redirect_if_opac_suppressed() tests' => sub {
Link Here
|
61 |
|
61 |
|
62 |
subtest 'not suppressed tests' => sub { |
62 |
subtest 'not suppressed tests' => sub { |
63 |
|
63 |
|
64 |
plan tests => 2; |
64 |
plan tests => 1; |
65 |
|
65 |
|
66 |
open STDOUT, '>', \$stdout; |
66 |
open STDOUT, '>', \$stdout; |
67 |
$opac_suppressed = 0; |
67 |
$opac_suppressed = 0; |
68 |
|
68 |
|
69 |
my $warnings; |
|
|
70 |
local $SIG{__WARN__} = sub { $warnings = shift }; |
71 |
redirect_if_opac_suppressed( $query, $biblio ); |
69 |
redirect_if_opac_suppressed( $query, $biblio ); |
72 |
|
70 |
|
73 |
is( $stdout, undef, 'No redirection if the biblio is not suppressed' ); |
71 |
is( $stdout, undef, 'No redirection if the biblio is not suppressed' ); |
74 |
ok( !$warnings, "safe_exit not called" ); |
|
|
75 |
|
72 |
|
76 |
close STDOUT; |
73 |
close STDOUT; |
77 |
}; |
74 |
}; |
78 |
|
75 |
|
79 |
subtest 'suppressed tests' => sub { |
76 |
subtest 'suppressed tests' => sub { |
80 |
|
77 |
|
81 |
plan tests => 11; |
78 |
plan tests => 10; |
82 |
|
79 |
|
83 |
$opac_suppressed = 1; |
80 |
$opac_suppressed = 1; |
84 |
|
81 |
|
Lines 151-162
subtest 'redirect_if_opac_suppressed() tests' => sub {
Link Here
|
151 |
|
148 |
|
152 |
$ENV{REMOTE_ADDR} = '192.168.0.115'; |
149 |
$ENV{REMOTE_ADDR} = '192.168.0.115'; |
153 |
|
150 |
|
154 |
my $warnings; |
|
|
155 |
local $SIG{__WARN__} = sub { $warnings = shift }; |
156 |
redirect_if_opac_suppressed( $query, $biblio ); |
151 |
redirect_if_opac_suppressed( $query, $biblio ); |
157 |
|
152 |
|
158 |
is( $stdout, undef, 'No redirection if the IP is on the range' ); |
153 |
is( $stdout, undef, 'No redirection if the IP is on the range' ); |
159 |
ok( !$warnings, "safe_exit not called" ); |
|
|
160 |
|
154 |
|
161 |
undef $stdout; |
155 |
undef $stdout; |
162 |
|
156 |
|
163 |
- |
|
|