From 4c715fa0dbb0a92454b1e3012af8884ad4e12300 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 26 Nov 2019 12:57:17 +0000 Subject: [PATCH] Bug 23274: Mock simple_search_compat to cover both search engines Signed-off-by: Michal Denar Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson --- t/db_dependent/XISBN.t | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/XISBN.t b/t/db_dependent/XISBN.t index 5ca2b7a538..d83419fb70 100755 --- a/t/db_dependent/XISBN.t +++ b/t/db_dependent/XISBN.t @@ -22,9 +22,11 @@ BEGIN { my $schema = Koha::Database->new->schema; $schema->storage->txn_begin; -my $search_module = new Test::MockModule('C4::Search'); +my $engine = C4::Context->preference("SearchEngine") // 'Zebra'; +my $search_module = new Test::MockModule("Koha::SearchEngine::${engine}::Search"); + +$search_module->mock('simple_search_compat', \&Mock_simple_search_compat ); -$search_module->mock('SimpleSearch', \&Mock_SimpleSearch ); my $errors; my $context = C4::Context->new; @@ -95,8 +97,9 @@ sub _add_biblio_with_isbn { # Mocked subs -# C4::Search::SimpleSearch -sub Mock_SimpleSearch { +# Koha::SearchEngine::${SearchEngine}::Search::simple_search_compat +sub Mock_simple_search_compat { + my $self = shift; my $query = shift; my @results; -- 2.11.4.GIT