NAME
DBIx::Migration::Directories::Test - Convienence class for unit tests
SYNOPSIS
use Test::More;
use DBIx::Transaction;
{
package My::Schema::Test;
use base qw(
My::Schema DBIx::Migration::Directories::Test
);
}
my $dbh =
eval { DBIx::Transaction->connect('DBI:mysql:dbname=test', 'root', '') }
or plan skip_all => "Could not connect to database: $@";
my $migration = My::Schema::Test->new_test(
dir => 'schema/mysql', dbh => $dbh,
schema => 'My::Schema',
tests => [
sub {
ok(
$dbh->do(q{
INSERT INTO mytable (my_time) VALUES (now())
}),
"insert an item stub into the database"
);
}
]
);
plan tests => $migration->num_tests;
$migration->run_tests;
DESCRIPTION
This is a very simple wrapper around DBIx::Migration::Directories
to assist with running unit tests. It installs your schema before running tests, and removes it after. It will skip running your tests if the schema is already installed. If your tests crash, it will attempt to uninstall the schema.
For more information, view the source. It's pretty short.
AUTHOR
Tyler "Crackerjack" MacDonald <japh@crackerjack.net>
LICENSE
Copyright 2009 Tyler "Crackerjack" MacDonald <japh@crackerjack.net>
This is free software; You may distribute it under the same terms as perl itself.
SEE ALSO
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 153:
=cut found outside a pod block. Skipping to next block.