allow overriding of public cgi-bin paths
[catagits/Catalyst-Controller-WrapCGI.git] / t / cgibin.t
1 #!perl
2
3 use strict;
4 use warnings;
5
6 use FindBin '$Bin';
7 use lib "$Bin/lib";
8
9 use Test::More tests => 4;
10
11 use Catalyst::Test 'TestCGIBin';
12 use HTTP::Request::Common;
13
14 # this should be ignored
15 $ENV{MOD_PERL} = "mod_perl/2.0";
16
17 my $response = request POST '/my-bin/path/test.pl', [
18     foo => 'bar',
19     bar => 'baz'
20 ];
21
22 is($response->content, 'foo:bar bar:baz', 'POST to Perl CGI File');
23
24 $response = request POST '/cgihandler/dongs', [
25     foo => 'bar',
26     bar => 'baz'
27 ];
28
29 is($response->content, 'foo:bar bar:baz',
30     'POST to Perl CGI File through a forward');
31
32 $response = request POST '/cgihandler/mtfnpy', [
33     foo => 'bar',
34     bar => 'baz'
35 ];
36
37 is($response->content, 'foo:bar bar:baz',
38     'POST to Perl CGI File through a forward via cgi_action');
39
40 SKIP: {
41     skip "Can't run shell scripts on non-*nix", 1
42         if $^O eq 'MSWin32' || $^O eq 'VMS';
43
44     is(get('/my-bin/test.sh'), "Hello!\n", 'Non-Perl CGI File');
45 }