---
name: "Test::Mojo::Server"
section: "3pm"
platform: "linux"
package: "libmojolicious-perl"
version: "0.999926-1+squeeze2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/Test::Mojo::Server"
---

# Test::Mojo::Server(3pm)

Server Tests

## 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");
```

Command for external server start.

### "executable"

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

Mojo executable name.

### "home"

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

Home for application.

### "pid"

```
    my $pid = $server->pid;
```

Process id for external server.

### "port"

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

Server port.

### "timeout"

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

Timeout for external server startup.

## METHODS

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

### "new"

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

Construct a new Test::Mojo::Server object.

### "find\_executable\_ok"

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

Try to find Mojo executable.

### "generate\_port\_ok"

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

### "server\_ok"

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

Check if server is still running.

### "start\_daemon\_ok"

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

Start external Mojo::Server::Daemon server.

### "start\_daemon\_prefork\_ok"

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

Start external Mojo::Server::Daemon::Prefork server.

### "start\_server\_ok"

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

Start external server.

### "start\_server\_untested\_ok"

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

Start external server without testing the port.

### "stop\_server\_ok"

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

Stop external server.

## SEE ALSO

Mojolicious, Mojolicious::Guides, \<http://mojolicious.org\>.
