Commit | Line | Data |
ad9d93fc |
1 | use strict; |
2 | use warnings; |
3 | |
99618c49 |
4 | use File::Temp qw/ tempdir tmpnam /; |
0f89baa1 |
5 | use File::Spec; |
99618c49 |
6 | use Test::WWW::Mechanize; |
7 | |
ad9d93fc |
8 | my $dir = tempdir(); # CLEANUP => 1 ); |
9 | |
10 | use Test::More; |
11 | { |
12 | # Check exit status here |
13 | system("cd $dir; catalyst.pl TestApp"); |
14 | } |
15 | # Fix paths / nl work on win32 |
16 | chdir("$dir/TestApp/"); |
17 | warn($dir); |
18 | |
19 | # Ok, this is lame.. Also, check +x permissions? |
20 | my @files = qw| |
21 | Makefile.PL |
2cb998f9 |
22 | testapp.conf |
23 | lib/TestApp.pm |
24 | lib/TestApp/Controller/Root.pm |
25 | README |
26 | Changes |
27 | t/01app.t |
28 | t/02pod.t |
29 | t/03podcoverage.t |
30 | root/static/images/catalyst_logo.png |
31 | root/static/images/btn_120x50_built.png |
32 | root/static/images/btn_120x50_built_shadow.png |
33 | root/static/images/btn_120x50_powered.png |
34 | root/static/images/btn_120x50_powered_shadow.png |
35 | root/static/images/btn_88x31_built.png |
36 | root/static/images/btn_88x31_built_shadow.png |
37 | root/static/images/btn_88x31_powered.png |
38 | root/static/images/btn_88x31_powered_shadow.png |
39 | root/favicon.ico |
40 | Makefile.PL |
41 | script/testapp_cgi.pl |
42 | script/testapp_fastcgi.pl |
43 | script/testapp_server.pl |
44 | script/testapp_test.pl |
45 | script/testapp_create.pl |
ad9d93fc |
46 | |; |
47 | |
99618c49 |
48 | plan 'tests' => scalar @files + 4; |
ad9d93fc |
49 | |
50 | foreach my $fn (@files) { |
51 | ok -r $fn, "Have $fn in generated app"; |
52 | } |
53 | |
20859489 |
54 | ## Makefile stuff |
55 | my $makefile_status = `$^X Makefile.PL`; |
56 | ok $makefile_status, "Makefile ran okay"; |
57 | ok -e "Makefile", "Makefile exists"; |
58 | my $newapp_test_status = `prove -l t/`; |
59 | ok $newapp_test_status, "Tests ran okay"; |
60 | #is $newapp_test_status, ; |
61 | |
99618c49 |
62 | ## Moosey server tests - kmx++ |
0f89baa1 |
63 | my $server_path = File::Spec->catfile('script', 'testapp_server.pl'); |
99618c49 |
64 | my $childpid = fork(); |
65 | |
66 | my $port = 3333; # or call some random generator |
816be347 |
67 | my $tmpfile = tmpnam(); # do not redirect to /dev/null as it will not work on Win32 |
99618c49 |
68 | |
69 | if ($childpid == 0) { |
99618c49 |
70 | system("$^X $server_path -p $port > $tmpfile 2>&1"); |
99618c49 |
71 | exit; |
72 | } |
73 | |
74 | sleep 10; #wait for catalyst application to start |
75 | my $mech = Test::WWW::Mechanize->new; |
76 | $mech->get_ok( "http://localhost:" . $port ); |
77 | |
78 | kill 'KILL', $childpid; |
816be347 |
79 | unlink $tmpfile; |
0f89baa1 |
80 | |