Test-MockDBI reviews

RSS | Module Info | Add a review of Test-MockDBI

Test-MockDBI (0.64)

I liked this article: www.perl.com/pub/2005/07/21/test_mock...
but was unable to use the module.

The prepare() method returns the mocked database handle ($self)
instead of something like a statement handle.

The usual meta data (like $sth->{NAME}) is missing,
which was important for my module.

This code was sufficient for the tests I was running so I didn't end up using Test::MockDBI:

my $mock_sth = Test::MockObject->new({

NAME_lc => [@columns]


my $mock_dbh = Test::MockObject->new();

$mock_dbh->mock('prepare', sub { $mock_sth });

$mock_sth->set_series('fetchrow_hashref', @data)

Test-MockDBI (0.61) ***

Useful, but limited.

Forced logging to stdout with no way to turn it off. No support for connect_cached or any of the hash fetching functions (eg fetchrow_hashref).

Interface is basic - the docs more or less encourage you to explicitly set the sql you're waiting for and return a fixed value when it is run. It *is* possible to do regexp matching on sql and return the result of a coderef, but it doesn't pass the sql to the code, so its use is limited.

The code is readable, but indenting is off, and it "use"s Data::Dumper twice :-)