Test::DBIx::Class::Schema - DBIx::Class schema sanity checking tests
Create a test script that looks like this:
# vim: ts=8 sts=4 et sw=4 sr sta
# load the module that provides all of the common test functionality
# create a new test object
my $schematest = Test::DBIx::Class::Schema->new(
dsn => 'dbi:Pg:dbname=mydb',
namespace => 'MyDB::Schema',
moniker => 'SomeTable',
username => 'some_user',
password => 'opensesame',
# rather than calling diag will test that all columns/relationships
# are accounted for in your test and fail the test if not
test_missing => 1,
# tell it what to test
columns => [
relations => [
custom => [
resultsets => [
# run the tests
Run the test script:
prove -l t/schematest/xx.mydb.t
Under normal circumstances there is no need to add done_testing to your test script; it's automatically called at the end of run_tests() unless you are running tests under Test::Aggregate.
If you are running aggregated tests you will need to add
to your top-level script.
It's really useful to be able to test and confirm that DBIC classes have and support a known set of methods.
Testing these one-by-one is more than tedious and likely to discourage you from writing the relevant test scripts.
As a lazy person myself I don't want to write numerous near-identical scripts.
Test::DBIx::Class::Schema takes the copy-and-paste out of DBIC schema class testing.
DBIx::Class, Test::More, Test::Aggregate
Gianni Ceccarelli <email@example.com>, Darius Jokilehto, Jason Tang <firstname.lastname@example.org>
Chisel Wright <email@example.com>
This software is copyright (c) 2012 by Chisel Wright.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Test::DBIx::Class::Schema, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.