in reply to Re^2: Test::MockDBI example
in thread Test::MockDBI example [SOLVED]
Why should I want to mock my DbLibTry class?
Mocking DbLibTry::get_all_songs() is what you seem to be asking for when you write $mock_dbi->set_retval( method => 'get_all_songs', ...
I just want to mock all connections to a database.
Then you should be replacing your real DBI object with the fake one, as suggested earlier, something like $dblibtry->{dbh} = $mock_dbi; - and in this case of course you shouldn't call your connect, or you'll get a real DBI object.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Test::MockDBI example
by brilant_blue (Beadle) on Feb 10, 2015 at 09:13 UTC |