failing test for a certain case of specifying the site root
Robert Buels [Mon, 4 Oct 2010 22:58:23 +0000 (15:58 -0700)]
t/cgibin_root_path.t
t/lib/TestCGIBinRoot2.pm [new file with mode: 0644]
t/lib/TestCGIBinRoot2/Controller/CGIHandler.pm [new file with mode: 0644]
t/lib/TestCGIBinRoot2/another_root/cgi/path/test.pl [new file with mode: 0755]

index 876fbe7..7a17595 100644 (file)
@@ -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 (file)
index 0000000..ad7702f
--- /dev/null
@@ -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 (file)
index 0000000..2fc84d7
--- /dev/null
@@ -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 (executable)
index 0000000..0486369
--- /dev/null
@@ -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')