1 use Test::More tests => 1;
4 use Catalyst::Engine::HTTP;
5 use File::Temp qw/ tempdir tmpnam /;
8 use lib "$Bin/TestApp/lib";
10 use Catalyst::Test 'TestApp', {default_host => 'default.com'};
11 use Catalyst::Request;
12 use Test::WWW::Mechanize;
14 $ENV{CATALYST_ENGINE} ||= 'HTTP';
15 $ENV{CATALYST_SCRIPT_GEN} = 31;
16 require Catalyst::Engine::HTTP;
18 my $dir = tempdir(); # CLEANUP => 1 );
19 my $devnull = File::Spec->devnull;
21 my $server_path = File::Spec->catfile('script', 'testapp_server.pl');
22 my $port = int(rand(10000)) + 40000; # get random port between 40000-50000
24 my $childpid = fork();
25 die "fork() error, cannot continue" unless defined($childpid);
28 system("$^X $server_path --listen $port > $devnull 2>&1");
29 exit; # just for sure; we should never got here
32 sleep 10; #wait for catalyst application to start
33 my $mech = Test::WWW::Mechanize->new;
34 $mech->get_ok( "http://localhost:" . $port );
36 kill 'KILL', $childpid;