4 use File::Temp qw/ tempdir tmpnam /;
6 use Test::WWW::Mechanize;
10 my $devnull = File::Spec->devnull;
18 if ($^O eq 'MSWin32') {
19 $exit = system("cd $dir & catalyst TestApp > $devnull 2>&1");
22 $exit = system("cd $dir; catalyst.pl TestApp > $devnull 2>&1");
24 is $exit, 0, 'Exit status ok';
26 # FIXME paths / nl work on win32
27 chdir("$dir/TestApp/");
33 lib/TestApp/Controller/Root.pm
39 root/static/images/catalyst_logo.png
40 root/static/images/btn_120x50_built.png
41 root/static/images/btn_120x50_built_shadow.png
42 root/static/images/btn_120x50_powered.png
43 root/static/images/btn_120x50_powered_shadow.png
44 root/static/images/btn_88x31_built.png
45 root/static/images/btn_88x31_built_shadow.png
46 root/static/images/btn_88x31_powered.png
47 root/static/images/btn_88x31_powered_shadow.png
51 script/testapp_fastcgi.pl
52 script/testapp_server.pl
53 script/testapp_test.pl
54 script/testapp_create.pl
57 foreach my $fn (@files) {
58 ok -r $fn, "Have $fn in generated app";
59 if ($fn =~ /script/) {
60 ok -x $fn, "$fn is executable";
65 my $makefile_status = `$^X Makefile.PL`;
66 ok $makefile_status, "Makefile ran okay";
67 ok -e "Makefile", "Makefile exists";
69 is system("make"), 0, 'Run make';
72 local $ENV{TEST_POD} = 1;
74 foreach my $test (grep { m|^t/| } @files) {
75 subtest "Generated app test: $test", sub {
81 ## Moosey server tests - kmx++
82 my $server_path = File::Spec->catfile('script', 'testapp_server.pl');
83 my $port = int(rand(10000)) + 40000; # get random port between 40000-50000
85 my $childpid = fork();
86 die "fork() error, cannot continue" unless defined($childpid);
89 system("$^X $server_path -p $port > $devnull 2>&1");
90 exit; # just for sure; we should never got here
93 sleep 10; #wait for catalyst application to start
94 my $mech = Test::WWW::Mechanize->new;
95 $mech->get_ok( "http://localhost:" . $port );
97 kill 'KILL', $childpid;
99 my $server_script = do {
100 open(my $fh, '<', 'script/testapp_server.pl') or die $!;
105 ok $server_script =~ qr/CATALYST_SCRIPT_GEN}\s+=\s+(\d+)/,
106 'SCRIPT_GEN found in generated output';
107 is $1, $Catalyst::Devel::CATALYST_SCRIPT_GEN, 'Script gen correct';