X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTestApp.pm;h=f18228cbc7b605f1822ea8a2f28163f7df15be94;hb=8c80e4f8ed93daf2d635c0480bdc97adf24e49c1;hp=8630a98757c0afe948ec8f77ccbe4eb9c6ac83fb;hpb=86d993abfe04d54984bca9c1c5a91139ec1eec42;p=catagits%2FCatalyst-Runtime.git diff --git a/t/lib/TestApp.pm b/t/lib/TestApp.pm index 8630a98..f18228c 100644 --- a/t/lib/TestApp.pm +++ b/t/lib/TestApp.pm @@ -1,7 +1,13 @@ package TestApp; use strict; -use Catalyst qw/Test::Errors Test::Headers Test::Plugin/; +use Catalyst qw/ + Test::Errors + Test::Headers + Test::Plugin + Test::Inline + +TestApp::Plugin::FullyQualified +/; use Catalyst::Utils; our $VERSION = '0.01'; @@ -50,13 +56,46 @@ sub execute { return $c->SUPER::execute(@_); } -sub class_forward_test_method { +# Replace the very large HTML error page with +# useful info if something crashes during a test +sub finalize_error { + my $c = shift; + + $c->NEXT::finalize_error(@_); + + $c->res->status(500); + $c->res->body( 'FATAL ERROR: ' . join( ', ', @{ $c->error } ) ); +} + +sub class_forward_test_method :Private { my ( $self, $c ) = @_; $c->response->headers->header( 'X-Class-Forward-Test-Method' => 1 ); } +sub loop_test : Local { + my ( $self, $c ) = @_; + + for( 1..1001 ) { + $c->forward( 'class_forward_test_method' ); + } +} + +sub recursion_test : Local { + my ( $self, $c ) = @_; + $c->forward( 'recursion_test' ); +} + { no warnings 'redefine'; sub Catalyst::Log::error { } } -1; + +# Make sure we can load Inline plugins. + +package Catalyst::Plugin::Test::Inline; + +use strict; + +use base qw/Catalyst::Base Class::Data::Inheritable/; + +1; \ No newline at end of file