DBIx::Migration::Directories::Test - Convienence class for unit tests
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;
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.
DBIx::Migration::Directories
For more information, view the source. It's pretty short.
Tyler "Crackerjack" MacDonald <japh@crackerjack.net>
Copyright 2009 Tyler "Crackerjack" MacDonald <japh@crackerjack.net>
This is free software; You may distribute it under the same terms as perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
=cut found outside a pod block. Skipping to next block.
To install DBIx::Migration::Directories, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Migration::Directories
CPAN shell
perl -MCPAN -e shell install DBIx::Migration::Directories
For more information on module installation, please visit the detailed CPAN module installation guide.