Bug 23274: Mock simple_search_compat to cover both search engines

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2019-11-26 12:57:17 +00:00 committed by Joy Nelson
parent ae4c86e87e
commit 4c715fa0db
1 changed files with 7 additions and 4 deletions

View File

@ -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;