NAME

Test::MockDBI - Perl extension for mocking database calls

SYNOPSIS

use Test::MockDBI;
use Test::More tests => 5;

BEGIN { use_ok('MyClass') };

my $mock = Test::MockDBI->new;

$mock->add_resultset([
    [ 'results' ],
    [ 'result1' ],
    [ 'result2' ],
    [ 'result3' ],
]);

can_ok 'MyClass', 'new';

my $o = MyClass->new();

isa_ok $o, 'MyClass';

is_deeply [ $o->results ], [qw/ result1 result2 result3 /], 'sql query returned results';

is_deeply [ $o->results ], [], 'sql query retured no results';

DESCRIPTION

Test::MockDBI provides a simplified interface to using DBD::Mock in your test cases. See the SYNOPSIS above for an example of how it can be used.

SEE ALSO

DBD::Mock

Test::MockObject

AUTHOR

Todd Caine, <tcaine@cac.washington.edu<gt>

COPYRIGHT AND LICENSE

Copyright 2005 by Todd Caine

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