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

(-)a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t (-3 lines)
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");
(-)a/t/db_dependent/Koha/SearchEngine/Zebra/QueryBuilder.t (-4 lines)
Lines 60-66 subtest 'build_query_compat() SearchLimitLibrary tests' => sub { Link Here
60
60
61
    my $query_builder = Koha::SearchEngine::Zebra::QueryBuilder->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
61
    my $query_builder = Koha::SearchEngine::Zebra::QueryBuilder->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
62
    t::lib::Mocks::mock_preference('SearchLimitLibrary', 'both');
62
    t::lib::Mocks::mock_preference('SearchLimitLibrary', 'both');
63
    diag(" SearchLimitLibrary set to 'both'");
64
    my ( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) =
63
    my ( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) =
65
        $query_builder->build_query_compat( undef, undef, undef, [ "branch:CPL" ], undef, undef, undef, undef );
64
        $query_builder->build_query_compat( undef, undef, undef, [ "branch:CPL" ], undef, undef, undef, undef );
66
    is( $limit, "(homebranch= CPL or holdingbranch= CPL)", "Branch limit expanded to home/holding branch");
65
    is( $limit, "(homebranch= CPL or holdingbranch= CPL)", "Branch limit expanded to home/holding branch");
Lines 73-79 subtest 'build_query_compat() SearchLimitLibrary tests' => sub { Link Here
73
    is( $limit_cgi, "&limit=multibranchlimit%3A$groupid", "Multibranch limit cgi does not get expanded");
72
    is( $limit_cgi, "&limit=multibranchlimit%3A$groupid", "Multibranch limit cgi does not get expanded");
74
73
75
    t::lib::Mocks::mock_preference('SearchLimitLibrary', 'homebranch');
74
    t::lib::Mocks::mock_preference('SearchLimitLibrary', 'homebranch');
76
    diag(" SearchLimitLibrary set to 'homebranch'");
77
    ( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) =
75
    ( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) =
78
        $query_builder->build_query_compat( undef, undef, undef, [ "branch:CPL" ], undef, undef, undef, undef );
76
        $query_builder->build_query_compat( undef, undef, undef, [ "branch:CPL" ], undef, undef, undef, undef );
79
    is( $limit, "(homebranch= CPL)", "branch limit expanded to home branch");
77
    is( $limit, "(homebranch= CPL)", "branch limit expanded to home branch");
Lines 86-92 subtest 'build_query_compat() SearchLimitLibrary tests' => sub { Link Here
86
    is( $limit_cgi, "&limit=multibranchlimit%3A$groupid", "Limit cgi does not get expanded");
84
    is( $limit_cgi, "&limit=multibranchlimit%3A$groupid", "Limit cgi does not get expanded");
87
85
88
    t::lib::Mocks::mock_preference('SearchLimitLibrary', 'holdingbranch');
86
    t::lib::Mocks::mock_preference('SearchLimitLibrary', 'holdingbranch');
89
    diag(" SearchLimitLibrary set to 'homebranch'");
90
    ( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) =
87
    ( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) =
91
        $query_builder->build_query_compat( undef, undef, undef, [ "branch:CPL" ], undef, undef, undef, undef );
88
        $query_builder->build_query_compat( undef, undef, undef, [ "branch:CPL" ], undef, undef, undef, undef );
92
    is( $limit, "(holdingbranch= CPL)", "branch limit expanded to holding branch");
89
    is( $limit, "(holdingbranch= CPL)", "branch limit expanded to holding branch");
93
- 

Return to bug 28847