View | Details | Raw Unified | Return to bug 31468
Collapse All | Expand All

(-)a/C4/Context.pm (-1 / +1 lines)
Lines 1009-1015 this is a PSGI app or a CGI app, and implementing code as appropriate. Link Here
1009
1009
1010
sub is_psgi_or_plack {
1010
sub is_psgi_or_plack {
1011
    my $is_psgi_or_plack = 0;
1011
    my $is_psgi_or_plack = 0;
1012
    if ( any { /(^psgi\.|^plack\.)/i } keys %ENV ) {
1012
    if ( any { /^(psgi|plack)[._]/i } keys %ENV ) {
1013
        $is_psgi_or_plack = 1;
1013
        $is_psgi_or_plack = 1;
1014
    }
1014
    }
1015
    return $is_psgi_or_plack;
1015
    return $is_psgi_or_plack;
(-)a/t/Context.t (-2 / +22 lines)
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 'is_psgi_or_plack' => sub {
150
    plan tests => 7;
151
152
    local %ENV = ( no_plack => 1 );
153
    is( C4::Context->is_psgi_or_plack, 0, 'no_plack' );
154
    $ENV{plackishere} = 1;
155
    is( C4::Context->is_psgi_or_plack, 0, 'plackishere is wrong' );
156
    $ENV{'plack.ishere'} = 1;
157
    is( C4::Context->is_psgi_or_plack, 1, 'plack.ishere' );
158
    delete $ENV{'plack.ishere'};
159
    is( C4::Context->is_psgi_or_plack, 0, 'plack.ishere was here' );
160
    $ENV{'plack_ishere'} = 1;
161
    is( C4::Context->is_psgi_or_plack, 1, 'plack_ishere' );
162
    delete $ENV{'plack_ishere'};
163
    $ENV{'psgi_whatever'} = 1;
164
    is( C4::Context->is_psgi_or_plack, 1, 'psgi_whatever' );
165
    delete $ENV{'psgi_whatever'};
166
    $ENV{'psgi.whatever'} = 1;
167
    is( C4::Context->is_psgi_or_plack, 1, 'psgi.whatever' );
168
};

Return to bug 31468