Commit | Line | Data |
040850b3 |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
040850b3 |
6 | use File::Path; |
7 | use FindBin; |
f0ee1a76 |
8 | use Test::More; |
9 | eval "use File::Copy::Recursive"; |
10 | |
11 | plan skip_all => 'File::Copy::Recursive required' if $@; |
12 | plan skip_all => 'set TEST_HTTP to enable this test' unless $ENV{TEST_HTTP}; |
040850b3 |
13 | |
14 | # clean up |
15 | rmtree "$FindBin::Bin/../../t/var" if -d "$FindBin::Bin/../../t/var"; |
16 | |
17 | # create a TestApp and copy the test libs into it |
18 | mkdir "$FindBin::Bin/../../t/var"; |
19 | chdir "$FindBin::Bin/../../t/var"; |
20 | system "$FindBin::Bin/../../script/catalyst.pl TestApp"; |
21 | chdir "$FindBin::Bin/../.."; |
22 | File::Copy::Recursive::dircopy( 't/live/lib', 't/var/TestApp/lib' ); |
23 | |
24 | # spawn the standalone HTTP server |
25 | my $pid = open SERVER, |
26 | "$FindBin::Bin/../../t/var/TestApp/script/testapp_server.pl 2>&1 |" |
27 | or die "Unable to spawn standalone HTTP server: $!"; |
28 | |
29 | # wait for it to start |
30 | sleep 2; |
31 | |
32 | # run the testsuite against the HTTP server |
33 | $ENV{CATALYST_SERVER} = 'http://localhost:3000'; |
34 | system( 'prove -r -Ilib/ t/live/' ); |
35 | |
36 | # shut it down |
37 | kill 2, $pid; |
38 | close SERVER; |
39 | |
40 | # clean up |
41 | rmtree "$FindBin::Bin/../../t/var" if -d "$FindBin::Bin/../../t/var"; |