From: Devin Austin Date: Thu, 25 Jun 2009 03:11:14 +0000 (+0000) Subject: added more to Test, added testapp_test, and worked on start_fcgi X-Git-Tag: 5.80014_02~127 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=451b2a4432a971fe5d12e108545677eb94295fab;p=catagits%2FCatalyst-Runtime.git added more to Test, added testapp_test, and worked on start_fcgi --- diff --git a/lib/Catalyst/Script/Test.pm b/lib/Catalyst/Script/Test.pm index 191e91f..8431fd2 100644 --- a/lib/Catalyst/Script/Test.pm +++ b/lib/Catalyst/Script/Test.pm @@ -1,3 +1,24 @@ package Catalyst::Script::Test; use Moose; +use Pod::Usage; +use FindBin; +use lib "$FindBin::Bin/../lib"; +with 'MooseX::Getopt'; +use namespace::clean -except => [ qw(meta) ]; + +has app => ( isa => 'Str', is => 'ro', required => 1 ); +has help => ( isa => 'Bool', is => 'ro', required => 0, default => sub { 0 } ); + + +sub run { + my $self = shift; + + Class::MOP::load_class("Catalyst::Test"); + Catalyst::Test->import($self->app); + + pod2usage(1) if ( $self->help || !$ARGV[1] ); + print request($ARGV[1])->content . "\n"; + +} + 1; diff --git a/t/TestApp/script/testapp_test.pl b/t/TestApp/script/testapp_test.pl index 1cc7cd3..2444a30 100755 --- a/t/TestApp/script/testapp_test.pl +++ b/t/TestApp/script/testapp_test.pl @@ -1,20 +1,10 @@ #!/usr/bin/env perl +use FindBin qw/$Bin/; -use strict; -use warnings; -use Getopt::Long; -use Pod::Usage; -use FindBin; -use lib "$FindBin::Bin/../lib"; -use Catalyst::Test 'TestApp'; - -my $help = 0; - -GetOptions( 'help|?' => \$help ); - -pod2usage(1) if ( $help || !$ARGV[0] ); - -print request($ARGV[0])->content . "\n"; +## because this is a test +use lib "$Bin/../../../lib"; +use Catalyst::ScriptRunner; +Catalyst::ScriptRunner->run('Catalyst','Test'); 1; diff --git a/t/start_fcgi.t b/t/start_fcgi.t index 3ac9bb1..266eff2 100644 --- a/t/start_fcgi.t +++ b/t/start_fcgi.t @@ -9,6 +9,7 @@ use File::Spec; use lib "$Bin/TestApp/lib"; use TestApp; use Test::WWW::Mechanize; +use Catalyst::Test 'TestApp'; my $dir = tempdir(); # CLEANUP => 1 ); my $devnull = File::Spec->devnull;