moved
[catagits/Catalyst-Controller-WrapCGI.git] / t / cgibin.t
CommitLineData
21a20b7e 1#!perl
2
3use strict;
4use warnings;
5
6use FindBin '$Bin';
7use lib "$Bin/lib";
8
fbaba9dd 9use Test::More tests => 7;
21a20b7e 10
11use Catalyst::Test 'TestCGIBin';
12use HTTP::Request::Common;
13
46a4350c 14# this should be ignored
15$ENV{MOD_PERL} = "mod_perl/2.0";
16
9cc2dd4c 17my $response = request POST '/my-bin/path/test.pl', [
21a20b7e 18 foo => 'bar',
19 bar => 'baz'
20];
21
22is($response->content, 'foo:bar bar:baz', 'POST to Perl CGI File');
23
bdb35995 24$response = request POST '/my-bin/exit.pl', [
25 name => 'world',
26];
27
28is($response->content, 'hello world', 'POST to Perl CGI with exit()');
29
30$response = request POST '/my-bin/exit.pl', [
31 name => 'world',
32 exit => 17,
33];
34
35is($response->code, 500, 'POST to Perl CGI with nonzero exit()');
36
21a20b7e 37$response = request POST '/cgihandler/dongs', [
38 foo => 'bar',
39 bar => 'baz'
40];
41
42is($response->content, 'foo:bar bar:baz',
43 'POST to Perl CGI File through a forward');
44
45$response = request POST '/cgihandler/mtfnpy', [
46 foo => 'bar',
47 bar => 'baz'
48];
49
50is($response->content, 'foo:bar bar:baz',
51 'POST to Perl CGI File through a forward via cgi_action');
52
63096ad1 53$response = request '/my-bin/path/testdata.pl';
fbaba9dd 54is($response->content, "testing\n",
55 'scripts with __DATA__ sections work');
56
21a20b7e 57SKIP: {
58 skip "Can't run shell scripts on non-*nix", 1
59 if $^O eq 'MSWin32' || $^O eq 'VMS';
60
9cc2dd4c 61 is(get('/my-bin/test.sh'), "Hello!\n", 'Non-Perl CGI File');
21a20b7e 62}