@@ -, +, @@ - Stop your MySQL server: $ sudo service mysql stop - Run $ prove t/Search.t - Apply the patch - Run $ prove t/Search.t the absence of the DB server - Sign off :-D --- t/Search.t | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) --- a/t/Search.t +++ a/t/Search.t @@ -18,12 +18,20 @@ use Modern::Perl; use Test::More tests => 3; - -BEGIN { - use_ok('C4::Search'); - can_ok('C4::Search', - qw/_build_initial_query/); -} +use Test::MockModule; +use DBD::Mock; + +# Mock the DB connexion and C4::Context +my $context = new Test::MockModule('C4::Context'); +$context->mock( '_new_dbh', sub { + my $dbh = DBI->connect( 'DBI:Mock:', '', '' ) + || die "Cannot create handle: $DBI::errstr\n"; + return $dbh; +}); + +use_ok('C4::Search'); +can_ok('C4::Search', + qw/_build_initial_query/); subtest "_build_initial_query tests" => sub { --