Bug 29418: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
This commit is contained in:
Tomas Cohen Arazi 2022-07-04 15:18:44 -03:00 committed by Victor Grousset/tuxayo
parent dfb8f224fa
commit 22b15df7ff
1 changed files with 15 additions and 1 deletions

View File

@ -17,7 +17,7 @@
use Modern::Perl;
use Test::More tests => 3;
use Test::More tests => 4;
use Test::MockModule;
use_ok('Koha::SearchEngine::Zebra::QueryBuilder');
@ -76,3 +76,17 @@ subtest 'build_query_compat() tests' => sub {
( undef, $query ) = $qb->build_query_compat( undef, undef, undef, undef, undef, undef, undef, { suppress => 0 } );
is( $query, 'query', 'Suppress part of the query not added (PQF)');
};
subtest 'clean_search_term() tests' => sub {
plan tests => 2;
my $qb;
ok(
$qb = Koha::SearchEngine::Zebra::QueryBuilder->new(),
'Creating a new QueryBuilder object'
);
my $res = $qb->clean_search_term('test "query":');
is($res, 'test \"query\":', 'Double-quotes are escaped');
};