convert all uses of Test::Exception to Test::Fatal
[catagits/Catalyst-Runtime.git] / t / psgi_file_testapp_engine_plackup_compat.t
CommitLineData
da054c21 1use strict;
2use warnings;
3use FindBin qw/$Bin/;
4use lib "$Bin/lib";
5
6use Test::More;
2a56ace9 7use Test::Fatal;
da054c21 8use Plack::Test;
9use TestApp;
10use HTTP::Request::Common;
11
a7536db7 12plan 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 15my $warning;
16local $SIG{__WARN__} = sub { $warning = $_[0] };
17
18TestApp->setup_engine('PSGI');
19my $app = sub { TestApp->run(@_) };
20
21like $warning, qr/You are running Catalyst\:\:Engine\:\:PSGI/,
22 'got deprecation alert warning';
23
24test_psgi $app, sub {
25 my $cb = shift;
2a56ace9 26 is exception {
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
2a56ace9 37 }, undef, q{app didn't die or timeout};
da054c21 38};
39
40done_testing;
41