Lines 725-761
subtest 'build_query_compat() SearchLimitLibrary tests' => sub {
Link Here
|
725 |
t::lib::Mocks::mock_preference('SearchLimitLibrary', 'both'); |
725 |
t::lib::Mocks::mock_preference('SearchLimitLibrary', 'both'); |
726 |
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 ) = |
727 |
$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 ); |
728 |
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"); |
729 |
is( $limit_desc, "(homebranch: CPL OR holdingbranch: CPL)", "Limit description correctly expanded"); |
729 |
is( $limit_desc, '(homebranch: "CPL" OR holdingbranch: "CPL")', "Limit description correctly expanded"); |
730 |
is( $limit_cgi, "&limit=branch%3ACPL", "Limit cgi does not get expanded"); |
730 |
is( $limit_cgi, '&limit=branch%3ACPL', "Limit cgi does not get expanded"); |
731 |
( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
731 |
( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
732 |
$query_builder->build_query_compat( undef, undef, undef, [ "multibranchlimit:$groupid" ], undef, undef, undef, undef ); |
732 |
$query_builder->build_query_compat( undef, undef, undef, [ "multibranchlimit:$groupid" ], undef, undef, undef, undef ); |
733 |
is( $limit, "(homebranch: $branchcodes[0] OR homebranch: $branchcodes[1] OR holdingbranch: $branchcodes[0] OR holdingbranch: $branchcodes[1])", "Multibranch limit expanded to home/holding branches"); |
733 |
is( $limit, "(homebranch: \"$branchcodes[0]\" OR homebranch: \"$branchcodes[1]\" OR holdingbranch: \"$branchcodes[0]\" OR holdingbranch: \"$branchcodes[1]\")", "Multibranch limit expanded to home/holding branches"); |
734 |
is( $limit_desc, "(homebranch: $branchcodes[0] OR homebranch: $branchcodes[1] OR holdingbranch: $branchcodes[0] OR holdingbranch: $branchcodes[1])", "Multibranch limit description correctly expanded"); |
734 |
is( $limit_desc, "(homebranch: \"$branchcodes[0]\" OR homebranch: \"$branchcodes[1]\" OR holdingbranch: \"$branchcodes[0]\" OR holdingbranch: \"$branchcodes[1]\")", "Multibranch limit description correctly expanded"); |
735 |
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"); |
736 |
|
736 |
|
737 |
t::lib::Mocks::mock_preference('SearchLimitLibrary', 'homebranch'); |
737 |
t::lib::Mocks::mock_preference('SearchLimitLibrary', 'homebranch'); |
738 |
( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
738 |
( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
739 |
$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 ); |
740 |
is( $limit, "(homebranch: CPL)", "branch limit expanded to home branch"); |
740 |
is( $limit, "(homebranch: \"CPL\")", "branch limit expanded to home branch"); |
741 |
is( $limit_desc, "(homebranch: CPL)", "limit description correctly expanded"); |
741 |
is( $limit_desc, "(homebranch: \"CPL\")", "limit description correctly expanded"); |
742 |
is( $limit_cgi, "&limit=branch%3ACPL", "limit cgi does not get expanded"); |
742 |
is( $limit_cgi, "&limit=branch%3ACPL", "limit cgi does not get expanded"); |
743 |
( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
743 |
( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
744 |
$query_builder->build_query_compat( undef, undef, undef, [ "multibranchlimit:$groupid" ], undef, undef, undef, undef ); |
744 |
$query_builder->build_query_compat( undef, undef, undef, [ "multibranchlimit:$groupid" ], undef, undef, undef, undef ); |
745 |
is( $limit, "(homebranch: $branchcodes[0] OR homebranch: $branchcodes[1])", "branch limit expanded to home branch"); |
745 |
is( $limit, "(homebranch: \"$branchcodes[0]\" OR homebranch: \"$branchcodes[1]\")", "branch limit expanded to home branch"); |
746 |
is( $limit_desc, "(homebranch: $branchcodes[0] OR homebranch: $branchcodes[1])", "limit description correctly expanded"); |
746 |
is( $limit_desc, "(homebranch: \"$branchcodes[0]\" OR homebranch: \"$branchcodes[1]\")", "limit description correctly expanded"); |
747 |
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"); |
748 |
|
748 |
|
749 |
t::lib::Mocks::mock_preference('SearchLimitLibrary', 'holdingbranch'); |
749 |
t::lib::Mocks::mock_preference('SearchLimitLibrary', 'holdingbranch'); |
750 |
( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
750 |
( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
751 |
$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 ); |
752 |
is( $limit, "(holdingbranch: CPL)", "branch limit expanded to holding branch"); |
752 |
is( $limit, "(holdingbranch: \"CPL\")", "branch limit expanded to holding branch"); |
753 |
is( $limit_desc, "(holdingbranch: CPL)", "Limit description correctly expanded"); |
753 |
is( $limit_desc, "(holdingbranch: \"CPL\")", "Limit description correctly expanded"); |
754 |
is( $limit_cgi, "&limit=branch%3ACPL", "Limit cgi does not get expanded"); |
754 |
is( $limit_cgi, "&limit=branch%3ACPL", "Limit cgi does not get expanded"); |
755 |
( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
755 |
( undef, undef, undef, undef, undef, $limit, $limit_cgi, $limit_desc, undef ) = |
756 |
$query_builder->build_query_compat( undef, undef, undef, [ "multibranchlimit:$groupid" ], undef, undef, undef, undef ); |
756 |
$query_builder->build_query_compat( undef, undef, undef, [ "multibranchlimit:$groupid" ], undef, undef, undef, undef ); |
757 |
is( $limit, "(holdingbranch: $branchcodes[0] OR holdingbranch: $branchcodes[1])", "branch limit expanded to holding branch"); |
757 |
is( $limit, "(holdingbranch: \"$branchcodes[0]\" OR holdingbranch: \"$branchcodes[1]\")", "branch limit expanded to holding branch"); |
758 |
is( $limit_desc, "(holdingbranch: $branchcodes[0] OR holdingbranch: $branchcodes[1])", "Limit description correctly expanded"); |
758 |
is( $limit_desc, "(holdingbranch: \"$branchcodes[0]\" OR holdingbranch: \"$branchcodes[1]\")", "Limit description correctly expanded"); |
759 |
is( $limit_cgi, "&limit=multibranchlimit%3A$groupid", "Limit cgi does not get expanded"); |
759 |
is( $limit_cgi, "&limit=multibranchlimit%3A$groupid", "Limit cgi does not get expanded"); |
760 |
|
760 |
|
761 |
}; |
761 |
}; |
762 |
- |
|
|