Lines 219-225
subtest 'build_authorities_query_compat() tests' => sub {
Link Here
|
219 |
}; |
219 |
}; |
220 |
|
220 |
|
221 |
subtest 'build_query tests' => sub { |
221 |
subtest 'build_query tests' => sub { |
222 |
plan tests => 63; |
222 |
plan tests => 57; |
223 |
|
223 |
|
224 |
my $qb; |
224 |
my $qb; |
225 |
|
225 |
|
Lines 254-278
subtest 'build_query tests' => sub {
Link Here
|
254 |
is( $query->{aggregations}{homebranch}{terms}{size}, 37,'we ask for the size as defined by the syspref FacetMaxCount for homebranch'); |
254 |
is( $query->{aggregations}{homebranch}{terms}{size}, 37,'we ask for the size as defined by the syspref FacetMaxCount for homebranch'); |
255 |
is( $query->{aggregations}{holdingbranch}{terms}{size}, 37,'we ask for the size as defined by the syspref FacetMaxCount for holdingbranch'); |
255 |
is( $query->{aggregations}{holdingbranch}{terms}{size}, 37,'we ask for the size as defined by the syspref FacetMaxCount for holdingbranch'); |
256 |
|
256 |
|
257 |
t::lib::Mocks::mock_preference('DisplayLibraryFacets','both'); |
|
|
258 |
$query = $qb->build_query(); |
259 |
ok( defined $query->{aggregations}{homebranch}, |
260 |
'homebranch added to facets if DisplayLibraryFacets=both' ); |
261 |
ok( defined $query->{aggregations}{holdingbranch}, |
262 |
'holdingbranch added to facets if DisplayLibraryFacets=both' ); |
263 |
t::lib::Mocks::mock_preference('DisplayLibraryFacets','holding'); |
264 |
$query = $qb->build_query(); |
265 |
ok( !defined $query->{aggregations}{homebranch}, |
266 |
'homebranch not added to facets if DisplayLibraryFacets=holding' ); |
267 |
ok( defined $query->{aggregations}{holdingbranch}, |
268 |
'holdingbranch added to facets if DisplayLibraryFacets=holding' ); |
269 |
t::lib::Mocks::mock_preference('DisplayLibraryFacets','home'); |
270 |
$query = $qb->build_query(); |
271 |
ok( defined $query->{aggregations}{homebranch}, |
272 |
'homebranch added to facets if DisplayLibraryFacets=home' ); |
273 |
ok( !defined $query->{aggregations}{holdingbranch}, |
274 |
'holdingbranch not added to facets if DisplayLibraryFacets=home' ); |
275 |
|
276 |
t::lib::Mocks::mock_preference( 'QueryAutoTruncate', '' ); |
257 |
t::lib::Mocks::mock_preference( 'QueryAutoTruncate', '' ); |
277 |
|
258 |
|
278 |
( undef, $query ) = $qb->build_query_compat( undef, ['donald duck'] ); |
259 |
( undef, $query ) = $qb->build_query_compat( undef, ['donald duck'] ); |
279 |
- |
|
|