From: John Napiorkowski Date: Fri, 22 Jul 2011 04:47:46 +0000 (-0400) Subject: new test to make sure people using legacy psgi engine who do not upgrade their psgi... X-Git-Tag: 5.89003~27 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=da054c21560085fcd1f96f7b33b388749544e9f6 new test to make sure people using legacy psgi engine who do not upgrade their psgi file and use plackup to start will still get a running app --- diff --git a/Makefile.PL b/Makefile.PL index 7a91b92..1d291f7 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -63,6 +63,7 @@ test_requires 'Class::Data::Inheritable'; test_requires 'Test::Exception'; test_requires 'Test::More' => '0.88'; test_requires 'Data::Dump'; +test_requires 'HTTP::Request::Common'; # aggregate tests if AGGREGATE_TESTS is set and a recent Test::Aggregate and a Test::Simple it works with is available if ($ENV{AGGREGATE_TESTS} && can_use('Test::Simple', '0.88') && can_use('Test::Aggregate', '0.364')) { diff --git a/t/psgi_file_testapp_engine_plackup_compat.t b/t/psgi_file_testapp_engine_plackup_compat.t new file mode 100644 index 0000000..54fdabb --- /dev/null +++ b/t/psgi_file_testapp_engine_plackup_compat.t @@ -0,0 +1,37 @@ +use strict; +use warnings; +use FindBin qw/$Bin/; +use lib "$Bin/lib"; + +use Test::More; +use Plack::Test; +use TestApp; +use HTTP::Request::Common; + +my $warning; +local $SIG{__WARN__} = sub { $warning = $_[0] }; + +TestApp->setup_engine('PSGI'); +my $app = sub { TestApp->run(@_) }; + +like $warning, qr/You are running Catalyst\:\:Engine\:\:PSGI/, + 'got deprecation alert warning'; + +test_psgi $app, sub { + my $cb = shift; + eval { + my $TIMEOUT_IN_SECONDS = 5; + local $SIG{ALRM} = sub { die "alarm\n" }; + alarm($TIMEOUT_IN_SECONDS); + + my $res = $cb->(GET "/"); + is $res->content, "root index", 'got expected content'; + like $warning, qr/env as a writer/, 'got deprecation alert warning'; + + alarm(0); + 1 + } || fail "$@ problem"; +}; + +done_testing; +