Chisel Wright > Test-DBIx-Class-Schema-0.01004 > Test::DBIx::Class::Schema

Download:
Test-DBIx-Class-Schema-0.01004.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.01004   Source   Latest Release: Test-DBIx-Class-Schema-0.01006

NAME ^

Test::DBIx::Class::Schema - DBIx::Class schema sanity checking tests

DESCRIPTION ^

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.

SYNOPSIS ^

Create a test script that looks like this:

    #!/usr/bin/perl
    # vim: ts=8 sts=4 et sw=4 sr sta
    use strict;
    use warnings;

    # load the module that provides all of the common test functionality
    use Test::DBIx::Class::Schema;

    # create a new test object
    my $schematest = Test::DBIx::Class::Schema->new(
        {
            # required
            dsn       => 'dbi:Pg:dbname=mydb',
            namespace => 'MyDB::Schema',
            moniker   => 'SomeTable',
            # optional
            username  => 'some_user',
            password  => 'opensesame',
        }
    );

    # tell it what to test
    $schematest->methods(
        {
            columns => [
                qw[
                    id
                    column1
                    column2
                    columnX
                    foo_id
                ]
            ],

            relations => [
                qw[
                    foo
                ]
            ],

            custom => [
                qw[
                    some_method
                ]
            ],

            resultsets => [
                qw[
                ]
            ],
        }
    );

    # run the tests
    $schematest->run_tests();

Run the test script:

  prove -l t/schematest/xx.mydb.t

SEE ALSO ^

DBIx::Class

AUTHOR ^

Chisel Wright <chiselwright@users.berlios.de>

LICENSE ^

Copyright 2008 by Chisel Wright

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See <http://www.perl.com/perl/misc/Artistic.html>