Test-MockDBI reviews

cpanratings
 

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]

})->set_true('execute')->set_true('finish');

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

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

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

Randy Stauner - 2010-11-30T13:16:42 (permalink)

1 out of 2 found this review helpful. Was this review helpful to you?  Yes No

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 :-)

adam - 2005-09-28T09:14:24 (permalink)

6 out of 6 found this review helpful. Was this review helpful to you?  Yes No