4 use File::Temp qw/ tempdir tmpnam /;
6 use Test::WWW::Mechanize;
8 my $dir = tempdir(); # CLEANUP => 1 );
9 my $devnull = File::Spec->devnull;
13 # Check exit status here
14 if ($^O eq 'MSWin32') {
15 system("cd $dir & catalyst TestApp > $devnull 2>&1");
18 system("cd $dir; catalyst.pl TestApp > $devnull 2>&1");
21 # Fix paths / nl work on win32
22 chdir("$dir/TestApp/");
25 # Ok, this is lame.. Also, check +x permissions?
30 lib/TestApp/Controller/Root.pm
36 root/static/images/catalyst_logo.png
37 root/static/images/btn_120x50_built.png
38 root/static/images/btn_120x50_built_shadow.png
39 root/static/images/btn_120x50_powered.png
40 root/static/images/btn_120x50_powered_shadow.png
41 root/static/images/btn_88x31_built.png
42 root/static/images/btn_88x31_built_shadow.png
43 root/static/images/btn_88x31_powered.png
44 root/static/images/btn_88x31_powered_shadow.png
48 script/testapp_fastcgi.pl
49 script/testapp_server.pl
50 script/testapp_test.pl
51 script/testapp_create.pl
52 script/testapp_deploy_schema.pl
55 plan 'tests' => scalar @files + 4;
57 foreach my $fn (@files) {
58 ok -r $fn, "Have $fn in generated app";
62 my $makefile_status = `$^X Makefile.PL`;
63 ok $makefile_status, "Makefile ran okay";
64 ok -e "Makefile", "Makefile exists";
65 my $newapp_test_status = `prove -l t/ 2> $devnull`;
66 ok $newapp_test_status, "Tests ran okay";
67 #is $newapp_test_status, ;
69 ## Moosey server tests - kmx++
70 my $server_path = File::Spec->catfile('script', 'testapp_server.pl');
71 my $port = int(rand(10000)) + 40000; # get random port between 40000-50000
73 my $childpid = fork();
74 die "fork() error, cannot continue" unless defined($childpid);
77 system("$^X $server_path -p $port > $devnull 2>&1");
78 exit; # just for sure; we should never got here
81 sleep 10; #wait for catalyst application to start
82 my $mech = Test::WWW::Mechanize->new;
83 $mech->get_ok( "http://localhost:" . $port );
85 kill 'KILL', $childpid;