|
Lines 18-24
Link Here
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use DBI; |
20 |
use DBI; |
| 21 |
use Test::More tests => 32; |
21 |
use Test::More tests => 33; |
| 22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
| 24 |
use YAML::XS; |
24 |
use YAML::XS; |
|
Lines 145-147
is( C4::Context->interface( 'CRON' ), 'cron', 'interface cron uc' );
Link Here
|
| 145 |
$ENV{HTTPS} = 'ON'; |
145 |
$ENV{HTTPS} = 'ON'; |
| 146 |
is( C4::Context->https_enabled, 1, "ON HTTPS env returns 1"); |
146 |
is( C4::Context->https_enabled, 1, "ON HTTPS env returns 1"); |
| 147 |
} |
147 |
} |
| 148 |
- |
148 |
|
|
|
149 |
subtest 'psgi_env and is_internal_PSGI_request' => sub { |
| 150 |
plan tests => 11; |
| 151 |
|
| 152 |
local %ENV = ( no_plack => 1 ); |
| 153 |
is( C4::Context->psgi_env, q{}, 'no_plack' ); |
| 154 |
$ENV{plackishere} = 1; |
| 155 |
is( C4::Context->psgi_env, q{}, 'plackishere is wrong' ); |
| 156 |
$ENV{'plack.ishere'} = 1; |
| 157 |
is( C4::Context->psgi_env, 1, 'plack.ishere' ); |
| 158 |
delete $ENV{'plack.ishere'}; |
| 159 |
is( C4::Context->psgi_env, q{}, 'plack.ishere was here' ); |
| 160 |
$ENV{'plack_ishere'} = 1; |
| 161 |
is( C4::Context->psgi_env, 1, 'plack_ishere' ); |
| 162 |
delete $ENV{'plack_ishere'}; |
| 163 |
$ENV{'psgi_whatever'} = 1; |
| 164 |
is( C4::Context->psgi_env, 1, 'psgi_whatever' ); |
| 165 |
delete $ENV{'psgi_whatever'}; |
| 166 |
$ENV{'psgi.whatever'} = 1; |
| 167 |
is( C4::Context->psgi_env, 1, 'psgi.whatever' ); |
| 168 |
delete $ENV{'psgi.whatever'}; |
| 169 |
$ENV{'PSGI.UPPERCASE'} = 1; |
| 170 |
is( C4::Context->psgi_env, 1, 'PSGI uppercase' ); |
| 171 |
|
| 172 |
$ENV{'REQUEST_URI'} = '/intranet/whatever'; |
| 173 |
is( C4::Context->is_internal_PSGI_request, 0, 'intranet not considered internal in regex' ); |
| 174 |
$ENV{'REQUEST_URI'} = '/api/v1/tralala'; |
| 175 |
is( C4::Context->is_internal_PSGI_request, 1, 'api considered internal in regex' ); |
| 176 |
delete $ENV{'PSGI.UPPERCASE'}; |
| 177 |
is( C4::Context->is_internal_PSGI_request, 0, 'api but no longer PSGI' ); |
| 178 |
}; |