Test::DB

Temporary Databases for Testing

method: create

package main;

use Test::DB;

my $tdb = Test::DB->new;

Types::Standard

This package provides a framework for setting up and tearing down temporary databases for testing purposes. This framework requires a user (optionally with password) which has the ability to create new databases and works by creating test-specific databases owned by the user specified using the naming convention: test_db_{time}_{proc}_{rand}.

The create method generates a database based on the type specified and returns a Test::DB::Object with an active connection, dbh and dsn. If the database specified doesn't have a corresponding database drive this method will returned the undefined value. The type of database can be omitted if the TESTDB_DATABASE environment variable is set, if not the type of database must be either sqlite, mysql, or postgres. Any options provided are passed along to the test database object class constructor.

create(Str :$database, Str %options) : Maybe[InstanceOf["Test::DB::Object"]]

=example-1 create

# given: synopsis

$tdb->create; # or $tdb->create(%options)

# <Test::DB::Object>

8 POD Errors

The following errors were encountered while parsing the POD:

Around line 10:

Unknown directive: =name

Around line 16:

Unknown directive: =abstract

Around line 22:

Unknown directive: =includes

Around line 28:

Unknown directive: =synopsis

Around line 38:

Unknown directive: =libraries

Around line 44:

Unknown directive: =description

Around line 54:

Unknown directive: =method

Around line 64:

Unknown directive: =signature