View | Details | Raw Unified | Return to bug 16976
Collapse All | Expand All

(-)a/t/Search/Zebra/QueryBuilder.t (-1 / +29 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/env perl
2
3
use Modern::Perl;
4
5
use Test::More tests => 1;
6
use_ok('Koha::SearchEngine::Zebra::QueryBuilder');
7
8
subtest 'build_authorities_query' => sub {
9
    plan tests => 2;
10
11
    my @test_search = (['mainmainentry'],['and'],[''],['contains'],['any'],'','HeadingAsc');
12
    my $expected_result = {
13
        marclist     => ['mainmainentry'],
14
        and_or       => ['and'],
15
        excluding    => [''],
16
        operator     => ['contains'],
17
        value        => ['any'],
18
        authtypecode => '',
19
        orderby      => 'HeadingAsc',
20
    };
21
    my $built_search = Koha::SearchEngine::Zebra::QueryBuilder->build_authorities_query(@test_search);
22
    is_deeply( $built_search, $expected_result, "We are simply hashifying our array of refs/values, should otherwise not be altered" );
23
    $expected_result->{value} = ['"any"'];
24
    $test_search[4] = ['"any"'];
25
    $built_search = Koha::SearchEngine::Zebra::QueryBuilder->build_authorities_query(@test_search);
26
    warn Data::Dumper::Dumper(  $built_search, $expected_result );
27
    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" );
28
};
29

Return to bug 16976