The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::Mojo::Server - Server Tests

SYNOPSIS

    use Test::Mojo::Server;

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

DESCRIPTION

Test::Mojo::Server is a collection of testing helpers specifically for developers of Mojo server bindings.

ATTRIBUTES

Test::Mojo::Server implements the following 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

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

new

    my $server = Test::Mojo::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');

SEE ALSO

Mojolicious, Mojolicious::Book, http://mojolicious.org.