Test::MockDBI

Test::MockDBI is Perl module mock DBI interface for testing.
Download

Test::MockDBI Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Mark Leighton Fisher
  • Publisher web site:
  • http://search.cpan.org/~mlfisher/Test-MockDBI-0.61/lib/Test/MockDBI.pm

Test::MockDBI Tags


Test::MockDBI Description

Test::MockDBI is Perl module mock DBI interface for testing. Test::MockDBI is Perl module mock DBI interface for testing.SYNOPSIS use Test::MockDBI; OR use Test::MockDBI qw( :all ); Test::MockDBI::set_dbi_test_type(42); if (Test::MockDBI::get_dbi_test_type() == 42) { ... $mock_dbi = get_instance Test::MockDBI; $mock_dbi->bad_method( $method_name, $dbi_testing_type, $matching_sql); $mock_dbi->bad_param( $dbi_testing_type, $param_number, $param_value); $mock_dbi->set_retval_array( $dbi_testing_type, $matching_sql, @retval || CODEREF); $mock_dbi->set_retval_array(MOCKDBI_WILDCARD, ... $mock_dbi->set_retval_scalar( $dbi_testing_type, $matching_sql, $retval || CODEREF); $mock_dbi->set_retval_scalar(MOCKDBI_WILDCARD, ... $mock_dbi->set_rows( $dbi_testing_type, $matching_sql, $rows || CODEREF); $mock_dbi->set_rows(MOCKDBI_WILDCARD, ...Test::MockDBI provides a way to test DBI interfaces by creating rules for changing the DBI's behavior, then examining the standard output for matching patterns.Testing using Test::MockDBI is enabled by setting the DBI testing type to a non-zero value. This can be done either by using a first program argument of "--dbitest", or by using the class method Test::MockDBI::set_dbi_test_type(). (Supplying a first argument of "--dbitest" often works well during testing.) TYPE is a simple integer (/^d+$/). Supplying "--dbitest" as a first argument works even if no other command-line processing is done, as Test::MockDBI does its own command-line processing to check for this first "--dbitest" argument. You will want to add "--dbitest" during a BEGIN block before the "use Test::MockDBI", so that the mock DBI is initialized as early as possible.TYPE is optional, as a first argument of "--dbitest" will set the DBI testing type to 1 (one). DBI testing is also disabled by "--dbitest=0" (although this may not be generally useful). The class method Test::MockDBI::set_dbi_test_type() can also be used to set or change the DBI testing type.Requirements:· Perl Requirements: · Perl


Test::MockDBI Related Software