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 Test::WWW::Mechanize;
12 $ENV{CATALYST_ENGINE} ||= 'HTTP';
13 $ENV{CATALYST_SCRIPT_GEN} = 31;
14 require Catalyst::Engine::HTTP;
16 my $dir = tempdir(); # CLEANUP => 1 );
17 my $devnull = File::Spec->devnull;
19 my $server_path = File::Spec->catfile('script', 'testapp_server.pl');
20 my $port = int(rand(10000)) + 40000; # get random port between 40000-50000
22 my $childpid = fork();
23 die "fork() error, cannot continue" unless defined($childpid);
26 system("$^X $server_path -p $port > $devnull 2>&1");
27 exit; # just for sure; we should never got here
30 sleep 10; #wait for catalyst application to start
31 my $mech = Test::WWW::Mechanize->new;
32 $mech->get_ok( "http://localhost:" . $port );
34 kill 'KILL', $childpid;