new test to make sure people using legacy psgi engine who do not upgrade their psgi...
[catagits/Catalyst-Runtime.git] / t / psgi_file_testapp_engine_plackup_compat.t
1 use strict;
2 use warnings;
3 use FindBin qw/$Bin/;
4 use lib "$Bin/lib";
5
6 use Test::More;
7 use Plack::Test;
8 use TestApp;
9 use HTTP::Request::Common;
10
11 my $warning;
12 local $SIG{__WARN__} = sub { $warning = $_[0] };
13
14 TestApp->setup_engine('PSGI');
15 my $app = sub { TestApp->run(@_) };
16
17 like $warning, qr/You are running Catalyst\:\:Engine\:\:PSGI/,
18   'got deprecation alert warning';
19
20 test_psgi $app, sub {
21     my $cb = shift;
22     eval {
23         my $TIMEOUT_IN_SECONDS = 5;
24         local $SIG{ALRM} = sub { die "alarm\n" };
25         alarm($TIMEOUT_IN_SECONDS);
26
27         my $res = $cb->(GET "/");
28         is $res->content, "root index", 'got expected content';
29         like $warning, qr/env as a writer/, 'got deprecation alert warning';
30
31         alarm(0);
32         1
33     } || fail "$@ problem";
34 };
35
36 done_testing;
37