|
Lines 723-729
subtest 'build_query_compat() SearchLimitLibrary tests' => sub {
Link Here
|
| 723 |
|
723 |
|
| 724 |
my $query_builder = Koha::SearchEngine::Elasticsearch::QueryBuilder->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); |
724 |
my $query_builder = Koha::SearchEngine::Elasticsearch::QueryBuilder->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); |
| 725 |
t::lib::Mocks::mock_preference('SearchLimitLibrary', 'both'); |
725 |
t::lib::Mocks::mock_preference('SearchLimitLibrary', 'both'); |
| 726 |
diag(" SearchLimitLibrary set to 'both'"); |
|
|
| 727 |
my ( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
726 |
my ( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
| 728 |
$query_builder->build_query_compat( undef, undef, undef, [ "branch:CPL" ], undef, undef, undef, undef ); |
727 |
$query_builder->build_query_compat( undef, undef, undef, [ "branch:CPL" ], undef, undef, undef, undef ); |
| 729 |
is( $limit, "(homebranch: CPL OR holdingbranch: CPL)", "Branch limit expanded to home/holding branch"); |
728 |
is( $limit, "(homebranch: CPL OR holdingbranch: CPL)", "Branch limit expanded to home/holding branch"); |
|
Lines 736-742
subtest 'build_query_compat() SearchLimitLibrary tests' => sub {
Link Here
|
| 736 |
is( $limit_cgi, "&limit=multibranchlimit%3A$groupid", "Multibranch limit cgi does not get expanded"); |
735 |
is( $limit_cgi, "&limit=multibranchlimit%3A$groupid", "Multibranch limit cgi does not get expanded"); |
| 737 |
|
736 |
|
| 738 |
t::lib::Mocks::mock_preference('SearchLimitLibrary', 'homebranch'); |
737 |
t::lib::Mocks::mock_preference('SearchLimitLibrary', 'homebranch'); |
| 739 |
diag(" SearchLimitLibrary set to 'homebranch'"); |
|
|
| 740 |
( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
738 |
( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
| 741 |
$query_builder->build_query_compat( undef, undef, undef, [ "branch:CPL" ], undef, undef, undef, undef ); |
739 |
$query_builder->build_query_compat( undef, undef, undef, [ "branch:CPL" ], undef, undef, undef, undef ); |
| 742 |
is( $limit, "(homebranch: CPL)", "branch limit expanded to home branch"); |
740 |
is( $limit, "(homebranch: CPL)", "branch limit expanded to home branch"); |
|
Lines 749-755
subtest 'build_query_compat() SearchLimitLibrary tests' => sub {
Link Here
|
| 749 |
is( $limit_cgi, "&limit=multibranchlimit%3A$groupid", "Limit cgi does not get expanded"); |
747 |
is( $limit_cgi, "&limit=multibranchlimit%3A$groupid", "Limit cgi does not get expanded"); |
| 750 |
|
748 |
|
| 751 |
t::lib::Mocks::mock_preference('SearchLimitLibrary', 'holdingbranch'); |
749 |
t::lib::Mocks::mock_preference('SearchLimitLibrary', 'holdingbranch'); |
| 752 |
diag(" SearchLimitLibrary set to 'homebranch'"); |
|
|
| 753 |
( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
750 |
( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
| 754 |
$query_builder->build_query_compat( undef, undef, undef, [ "branch:CPL" ], undef, undef, undef, undef ); |
751 |
$query_builder->build_query_compat( undef, undef, undef, [ "branch:CPL" ], undef, undef, undef, undef ); |
| 755 |
is( $limit, "(holdingbranch: CPL)", "branch limit expanded to holding branch"); |
752 |
is( $limit, "(holdingbranch: CPL)", "branch limit expanded to holding branch"); |