5 4_app_00_base.t - Check for the basic functionality of CGI::Ex::App.
9 use Test::More tests => 3;
15 use base qw(CGI::Ex::App);
16 use vars qw($test_stdout);
18 sub ready_validate { 1 }
27 my ($self, $step, $file, $swap) = @_;
28 my $out = ref($file) ? $$file : "No filenames allowed during test mode";
29 $self->cgix->swap_template(\$out, $swap);
33 ###----------------------------------------------------------------###
35 sub main_info_complete { 0 }
37 sub main_file_print { return \ "Main Content" }
39 sub step2_hash_validation { return {wow => {required => 1, required_error => 'wow is required'}} }
41 sub step2_file_print { return \ "Some step2 content ([% foo %], [% one %]) <input type=text name=wow>[% wow_error %]" }
43 sub step2_hash_swap { return {foo => 'bar', one => 'two'} }
45 sub step2_hash_fill { return {wow => 'wee'} }
47 sub step2_finalize { shift->append_path('step3') }
49 sub step3_info_complete { 0 }
51 sub step3_file_print { return \ "All good" }
55 ###----------------------------------------------------------------###
57 #$ENV{'REQUEST_METHOD'} = 'GET';
58 #$ENV{'QUERY_STRING'} = '';
63 ok($Foo::test_stdout eq "Main Content");
65 ###----------------------------------------------------------------###
67 #$ENV{'REQUEST_METHOD'} = 'GET';
68 #$ENV{'QUERY_STRING'} = 'step=step2';
71 form => {step => 'step2'},
73 ok($Foo::test_stdout eq "Some step2 content (bar, two) <input type=text name=wow value=\"wee\">wow is required");
75 ###----------------------------------------------------------------###
77 #$ENV{'REQUEST_METHOD'} = 'GET';
78 #$ENV{'QUERY_STRING'} = 'step=step2&wow=something';
81 form=> {step => 'step2', wow => 'something'},
83 ok($Foo::test_stdout eq "All good");