Lines 147-178
is( C4::Context->interface( 'CRON' ), 'cron', 'interface cron uc' );
Link Here
|
147 |
} |
147 |
} |
148 |
|
148 |
|
149 |
subtest 'psgi_env and is_internal_PSGI_request' => sub { |
149 |
subtest 'psgi_env and is_internal_PSGI_request' => sub { |
|
|
150 |
|
150 |
plan tests => 11; |
151 |
plan tests => 11; |
151 |
|
152 |
|
152 |
local %ENV = ( no_plack => 1 ); |
153 |
local %ENV = ( no_plack => 1 ); |
153 |
is( C4::Context->psgi_env, q{}, 'no_plack' ); |
154 |
ok( !C4::Context->psgi_env, 'no_plack' ); |
154 |
$ENV{plackishere} = 1; |
155 |
$ENV{plackishere} = 1; |
155 |
is( C4::Context->psgi_env, q{}, 'plackishere is wrong' ); |
156 |
ok( !C4::Context->psgi_env, 'plackishere is wrong' ); |
156 |
$ENV{'plack.ishere'} = 1; |
157 |
$ENV{'plack.ishere'} = 1; |
157 |
is( C4::Context->psgi_env, 1, 'plack.ishere' ); |
158 |
ok( C4::Context->psgi_env, 'plack.ishere' ); |
158 |
delete $ENV{'plack.ishere'}; |
159 |
delete $ENV{'plack.ishere'}; |
159 |
is( C4::Context->psgi_env, q{}, 'plack.ishere was here' ); |
160 |
ok( !C4::Context->psgi_env, 'plack.ishere was here' ); |
160 |
$ENV{'plack_ishere'} = 1; |
161 |
$ENV{'plack_env'} = 1; |
161 |
is( C4::Context->psgi_env, 1, 'plack_ishere' ); |
162 |
ok( C4::Context->psgi_env, 'plack_env' ); |
162 |
delete $ENV{'plack_ishere'}; |
163 |
delete $ENV{'plack_env'}; |
163 |
$ENV{'psgi_whatever'} = 1; |
164 |
$ENV{'psgi_whatever'} = 1; |
164 |
is( C4::Context->psgi_env, 1, 'psgi_whatever' ); |
165 |
ok( !C4::Context->psgi_env, 'psgi_whatever' ); |
165 |
delete $ENV{'psgi_whatever'}; |
166 |
delete $ENV{'psgi_whatever'}; |
166 |
$ENV{'psgi.whatever'} = 1; |
167 |
$ENV{'psgi.whatever'} = 1; |
167 |
is( C4::Context->psgi_env, 1, 'psgi.whatever' ); |
168 |
ok( C4::Context->psgi_env, 'psgi.whatever' ); |
168 |
delete $ENV{'psgi.whatever'}; |
169 |
delete $ENV{'psgi.whatever'}; |
169 |
$ENV{'PSGI.UPPERCASE'} = 1; |
170 |
$ENV{'PSGI.UPPERCASE'} = 1; |
170 |
is( C4::Context->psgi_env, 1, 'PSGI uppercase' ); |
171 |
ok( C4::Context->psgi_env, 'PSGI uppercase' ); |
171 |
|
172 |
|
172 |
$ENV{'REQUEST_URI'} = '/intranet/whatever'; |
173 |
$ENV{'REQUEST_URI'} = '/intranet/whatever'; |
173 |
is( C4::Context->is_internal_PSGI_request, 0, 'intranet not considered internal in regex' ); |
174 |
ok( !C4::Context->is_internal_PSGI_request, 'intranet not considered internal in regex' ); |
174 |
$ENV{'REQUEST_URI'} = '/api/v1/tralala'; |
175 |
$ENV{'REQUEST_URI'} = '/api/v1/tralala'; |
175 |
is( C4::Context->is_internal_PSGI_request, 1, 'api considered internal in regex' ); |
176 |
ok( C4::Context->is_internal_PSGI_request, 'api considered internal in regex' ); |
176 |
delete $ENV{'PSGI.UPPERCASE'}; |
177 |
delete $ENV{'PSGI.UPPERCASE'}; |
177 |
is( C4::Context->is_internal_PSGI_request, 0, 'api but no longer PSGI' ); |
178 |
ok( !C4::Context->is_internal_PSGI_request, 'api but no longer PSGI' ); |
178 |
}; |
179 |
}; |
179 |
- |
|
|