From 7c0ef761438a15b6f43764b6fbf06a6b36c6d675 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 7 Jul 2017 17:55:50 +0000 Subject: [PATCH] Bug 16976 - Unit tests --- t/Search/Zebra/QueryBuilder.t | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/t/Search/Zebra/QueryBuilder.t b/t/Search/Zebra/QueryBuilder.t index 42df1c5..0f2fbf8 100644 --- a/t/Search/Zebra/QueryBuilder.t +++ b/t/Search/Zebra/QueryBuilder.t @@ -8,7 +8,10 @@ use_ok('Koha::SearchEngine::Zebra::QueryBuilder'); subtest 'build_authorities_query' => sub { plan tests => 2; - my @test_search = (['mainmainentry'],['and'],[''],['contains'],['any'],'','HeadingAsc'); + my @test_search = ( + ['mainmainentry'], ['and'], [''], ['contains'], ['any'], '', + 'HeadingAsc' + ); my $expected_result = { marclist => ['mainmainentry'], and_or => ['and'], @@ -18,12 +21,19 @@ subtest 'build_authorities_query' => sub { authtypecode => '', orderby => 'HeadingAsc', }; - my $built_search = Koha::SearchEngine::Zebra::QueryBuilder->build_authorities_query(@test_search); - is_deeply( $built_search, $expected_result, "We are simply hashifying our array of refs/values, should otherwise not be altered" ); + my $built_search = + Koha::SearchEngine::Zebra::QueryBuilder->build_authorities_query( + @test_search); + is_deeply( $built_search, $expected_result, +"We are simply hashifying our array of refs/values, should otherwise not be altered" + ); $expected_result->{value} = ['"any"']; $test_search[4] = ['"any"']; - $built_search = Koha::SearchEngine::Zebra::QueryBuilder->build_authorities_query(@test_search); - warn Data::Dumper::Dumper( $built_search, $expected_result ); - is_deeply( $built_search, $expected_result, "The same should hold true if the search contains double quotes which will be escaped during searching by search_auth_compat subroutine" ); + $built_search = + Koha::SearchEngine::Zebra::QueryBuilder->build_authorities_query( + @test_search); + is_deeply( $built_search, $expected_result, +"The same should hold true if the search contains double quotes which will be escaped during searching by search_auth_compat subroutine" + ); }; -- 2.1.4