From: Robert Buels Date: Mon, 4 Oct 2010 22:58:23 +0000 (-0700) Subject: failing test for a certain case of specifying the site root X-Git-Tag: 0.031~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Controller-WrapCGI.git;a=commitdiff_plain;h=053b8d71181f5c6ce0e666067463c315c651d610 failing test for a certain case of specifying the site root --- diff --git a/t/cgibin_root_path.t b/t/cgibin_root_path.t index 876fbe7..7a17595 100644 --- a/t/cgibin_root_path.t +++ b/t/cgibin_root_path.t @@ -6,16 +6,34 @@ use warnings; use FindBin '$Bin'; use lib "$Bin/lib"; -use Test::More tests => 1; - -use Catalyst::Test 'TestCGIBinRoot'; -use HTTP::Request::Common; +use Test::More tests => 2; # Test configurable path root and dir +{ package root_test; + + use Test::More; + use HTTP::Request::Common; + use Catalyst::Test 'TestCGIBinRoot'; + + my $response = request POST '/cgi/path/test.pl', [ + foo => 'bar', + bar => 'baz' + ]; + + is($response->content, 'foo:bar bar:baz', 'POST to Perl CGI File'); +} + +# test another variation on specifying the root path +{ package another_root_test; + + use Test::More; + use HTTP::Request::Common; + use Catalyst::Test 'TestCGIBinRoot2'; -my $response = request POST '/cgi/path/test.pl', [ - foo => 'bar', - bar => 'baz' -]; + my $response = request POST '/cgi/path/test.pl', [ + foo => 'bar', + bar => 'baz' + ]; -is($response->content, 'foo:bar bar:baz', 'POST to Perl CGI File'); + is($response->content, 'foo:bar bar:baz', 'POST to Perl CGI File 2'); +} diff --git a/t/lib/TestCGIBinRoot2.pm b/t/lib/TestCGIBinRoot2.pm new file mode 100644 index 0000000..ad7702f --- /dev/null +++ b/t/lib/TestCGIBinRoot2.pm @@ -0,0 +1,16 @@ +package TestCGIBinRoot2; + +use Catalyst::Runtime '5.70'; +use parent 'Catalyst'; + +__PACKAGE__->config({ + root => 'another_root', + Controller::CGIHandler => { + cgi_root_path => 'cgi', + cgi_dir => 'cgi' + } +}); + +__PACKAGE__->setup(qw/Static::Simple/); + +1; diff --git a/t/lib/TestCGIBinRoot2/Controller/CGIHandler.pm b/t/lib/TestCGIBinRoot2/Controller/CGIHandler.pm new file mode 100644 index 0000000..2fc84d7 --- /dev/null +++ b/t/lib/TestCGIBinRoot2/Controller/CGIHandler.pm @@ -0,0 +1,5 @@ +package TestCGIBinRoot2::Controller::CGIHandler; + +use parent 'Catalyst::Controller::CGIBin'; + +1; diff --git a/t/lib/TestCGIBinRoot2/another_root/cgi/path/test.pl b/t/lib/TestCGIBinRoot2/another_root/cgi/path/test.pl new file mode 100755 index 0000000..0486369 --- /dev/null +++ b/t/lib/TestCGIBinRoot2/another_root/cgi/path/test.pl @@ -0,0 +1,11 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use CGI ':standard'; + +die '$ENV{MOD_PERL} must not be set' if $ENV{MOD_PERL}; + +print header; +print 'foo:',param('foo'),' bar:',param('bar')