Lines 81-87
subtest 'json2marc' => sub {
Link Here
|
81 |
}; |
81 |
}; |
82 |
|
82 |
|
83 |
subtest 'build_query tests' => sub { |
83 |
subtest 'build_query tests' => sub { |
84 |
plan tests => 6; |
84 |
plan tests => 10; |
85 |
|
85 |
|
86 |
t::lib::Mocks::mock_preference('DisplayLibraryFacets','both'); |
86 |
t::lib::Mocks::mock_preference('DisplayLibraryFacets','both'); |
87 |
my $query = $builder->build_query(); |
87 |
my $query = $builder->build_query(); |
Lines 101-105
subtest 'build_query tests' => sub {
Link Here
|
101 |
'homebranch added to facets if DisplayLibraryFacets=home' ); |
101 |
'homebranch added to facets if DisplayLibraryFacets=home' ); |
102 |
ok( !defined $query->{aggregations}{holdingbranch}, |
102 |
ok( !defined $query->{aggregations}{holdingbranch}, |
103 |
'holdingbranch not added to facets if DisplayLibraryFacets=home' ); |
103 |
'holdingbranch not added to facets if DisplayLibraryFacets=home' ); |
|
|
104 |
|
105 |
t::lib::Mocks::mock_preference('QueryAutoTruncate',''); |
106 |
( undef, $query ) = $builder->build_query_compat( undef, ['donald duck'] ); |
107 |
is( $query->{query}{query_string}{query}, "(donald duck)", "query not altered if QueryAutoTruncate disabled" ); |
108 |
|
109 |
t::lib::Mocks::mock_preference('QueryAutoTruncate','1'); |
110 |
( undef, $query ) = $builder->build_query_compat( undef, ['donald duck'] ); |
111 |
is( $query->{query}{query_string}{query}, "(donald* duck*)", "simple query is auto truncated when QueryAutoTruncate enabled" ); |
112 |
( undef, $query ) = $builder->build_query_compat( undef, ['donald or duck and mickey not mouse'] ); |
113 |
is( $query->{query}{query_string}{query}, "(donald* or duck* and mickey* not mouse*)", "reserved words are not affected by QueryAutoTruncate" ); #Ensure reserved words are not truncated |
114 |
( undef, $query ) = $builder->build_query_compat( undef, ['donald* duck*'] ); |
115 |
is( $query->{query}{query_string}{query}, "(donald* duck*)", "query with '*' is unaltered when QueryAutoTruncate is enabled" ); |
116 |
|
117 |
|
104 |
}; |
118 |
}; |
105 |
|
119 |
|
106 |
- |
|
|