Commit | Line | Data |
da054c21 |
1 | use strict; |
2 | use warnings; |
3 | use FindBin qw/$Bin/; |
4 | use lib "$Bin/lib"; |
5 | |
6 | use Test::More; |
57ecbde4 |
7 | use Test::Exception; |
da054c21 |
8 | use Plack::Test; |
9 | use TestApp; |
10 | use HTTP::Request::Common; |
11 | |
a7536db7 |
12 | plan skip_all => "Catalyst::Engine::PSGI required for this test" |
4a0dc259 |
13 | unless eval { local $SIG{__WARN__} = sub{}; require Catalyst::Engine::PSGI; 1; }; |
a7536db7 |
14 | |
da054c21 |
15 | my $warning; |
16 | local $SIG{__WARN__} = sub { $warning = $_[0] }; |
17 | |
18 | TestApp->setup_engine('PSGI'); |
19 | my $app = sub { TestApp->run(@_) }; |
20 | |
21 | like $warning, qr/You are running Catalyst\:\:Engine\:\:PSGI/, |
22 | 'got deprecation alert warning'; |
23 | |
24 | test_psgi $app, sub { |
25 | my $cb = shift; |
57ecbde4 |
26 | lives_ok { |
da054c21 |
27 | my $TIMEOUT_IN_SECONDS = 5; |
28 | local $SIG{ALRM} = sub { die "alarm\n" }; |
29 | alarm($TIMEOUT_IN_SECONDS); |
30 | |
31 | my $res = $cb->(GET "/"); |
32 | is $res->content, "root index", 'got expected content'; |
33 | like $warning, qr/env as a writer/, 'got deprecation alert warning'; |
34 | |
35 | alarm(0); |
36 | 1 |
57ecbde4 |
37 | } q{app didn't die or timeout}; |
da054c21 |
38 | }; |
39 | |
40 | done_testing; |
41 | |