NAME

Test::Mojo::Server - Server Tests

SYNOPSIS

use Mojo::Transaction;
use Mojo::Test::Server;

my $server = Test::Mojo::Server->new;
$server->start_daemon_ok;
$server->stop_server_ok;

DESCRIPTION

Mojo::Test::Server is a test harness for server tests.

ATTRIBUTES

command

my $command = $server->command;
$server     = $server->command("lighttpd -D -f $config");

executable

my $script = $server->executable;
$server    = $server->executable('mojo');

home

my $home = $server->home;
$server  = $server->home(Mojo::Home->new);

pid

my $pid = $server->pid;

port

my $port = $server->port;
$server  = $server->port(3000);

timeout

my $timeout = $server->timeout;
$server     = $server->timeout(5);

METHODS

Mojo::Test::Server inherits all methods from Mojo::Base and implements the following new ones.

new

my $server = Mojo::Test::Server->new;

find_executable_ok

my $path = $server->find_executable_ok;
my $path = $server->find_executable_ok('executable found');

generate_port_ok

my $port = $server->generate_port_ok;
my $port = $server->generate_port_ok('port test');

server_ok

$server->server_ok('server running');

start_daemon_ok

my $port = $server->start_daemon_ok('daemon test');

start_daemon_prefork_ok

my $port = $server->start_daemon_prefork_ok('prefork daemon test');

start_server_ok

my $port = $server->start_server_ok('server test');

start_server_untested_ok

my $port = $server->start_server_untested_ok('server test');

stop_server_ok

$server->stop_server_ok('server stopped');