| 1 | use Test::More tests => 7; |
| 2 | |
| 3 | use CGI; |
| 4 | |
| 5 | # Include the test hierarchy |
| 6 | use lib 't/lib'; |
| 7 | |
| 8 | # Can we even use this module? |
| 9 | use_ok('TestApp8'); |
| 10 | |
| 11 | # Prevent output to STDOUT |
| 12 | $ENV{CGI_APP_RETURN_ONLY} = 1; |
| 13 | |
| 14 | # Test array-ref mode |
| 15 | { |
| 16 | my $ta_obj = TestApp8->new(); |
| 17 | my $output = $ta_obj->run(); |
| 18 | |
| 19 | # Did the run mode work? |
| 20 | like($output, qr/^Content\-Type\:\ text\/html/); |
| 21 | like($output, qr/Hello\ World\:\ testcgi1\_mode\ OK/); |
| 22 | } |
| 23 | |
| 24 | |
| 25 | { |
| 26 | my $q = CGI->new({rm=>testcgi2_mode}); |
| 27 | my $ta_obj = TestApp8->new(QUERY=>$q); |
| 28 | my $output = $ta_obj->run(); |
| 29 | |
| 30 | # Did the run mode work? |
| 31 | like($output, qr/^Content\-Type\:\ text\/html/); |
| 32 | like($output, qr/Hello\ World\:\ testcgi2\_mode\ OK/); |
| 33 | } |
| 34 | |
| 35 | |
| 36 | { |
| 37 | my $q = CGI->new({rm=>testcgi3_mode}); |
| 38 | my $ta_obj = TestApp8->new(QUERY=>$q); |
| 39 | my $output = $ta_obj->run(); |
| 40 | |
| 41 | # Did the run mode work? |
| 42 | like($output, qr/^Content\-Type\:\ text\/html/); |
| 43 | like($output, qr/Hello\ World\:\ testcgi3\_mode\ OK/); |
| 44 | } |
| 45 | |
| 46 | |
| 47 | ############### |
| 48 | #### EOF #### |
| 49 | ############### |