Lines 129-134
$contextmodule->mock('preference', sub {
Link Here
|
129 |
return '--'; |
129 |
return '--'; |
130 |
} elsif ($pref eq 'DisplayLibraryFacets') { |
130 |
} elsif ($pref eq 'DisplayLibraryFacets') { |
131 |
return 'holding'; |
131 |
return 'holding'; |
|
|
132 |
} elsif ($pref eq 'UNIMARCAuthorsFacetsSeparator') { |
133 |
return '--'; |
132 |
} else { |
134 |
} else { |
133 |
warn "The syspref $pref was requested but I don't know what to say; this indicates that the test requires updating" |
135 |
warn "The syspref $pref was requested but I don't know what to say; this indicates that the test requires updating" |
134 |
unless $pref =~ m/(XSLT|item|branch|holding|image)/i; |
136 |
unless $pref =~ m/(XSLT|item|branch|holding|image)/i; |
Lines 859-865
if ( $indexing_mode eq 'dom' ) {
Link Here
|
859 |
|
861 |
|
860 |
# Test facet calculation |
862 |
# Test facet calculation |
861 |
my $facets_counter = {}; |
863 |
my $facets_counter = {}; |
862 |
my $facets_info = {}; |
|
|
863 |
my $facets = C4::Koha::getFacets(); |
864 |
my $facets = C4::Koha::getFacets(); |
864 |
# Create a record with a 100$z field |
865 |
# Create a record with a 100$z field |
865 |
my $marc_record = MARC::Record->new; |
866 |
my $marc_record = MARC::Record->new; |
Lines 869-875
if ( $indexing_mode eq 'dom' ) {
Link Here
|
869 |
[ '100', 'z', ' ', a => 'Tomasito' ], |
870 |
[ '100', 'z', ' ', a => 'Tomasito' ], |
870 |
[ '245', ' ', ' ', a => 'First try' ] |
871 |
[ '245', ' ', ' ', a => 'First try' ] |
871 |
); |
872 |
); |
872 |
C4::Search::_get_facets_data_from_record($marc_record, $facets, $facets_counter,$facets_info); |
873 |
C4::Search::_get_facets_data_from_record( $marc_record, $facets, $facets_counter ); |
873 |
is_deeply( { au => { 'Cohen Arazi, Tomas' => 1 } }, $facets_counter, |
874 |
is_deeply( { au => { 'Cohen Arazi, Tomas' => 1 } }, $facets_counter, |
874 |
"_get_facets_data_from_record doesn't count 100\$z (Bug 12788)"); |
875 |
"_get_facets_data_from_record doesn't count 100\$z (Bug 12788)"); |
875 |
$marc_record = MARC::Record->new; |
876 |
$marc_record = MARC::Record->new; |
Lines 879-888
if ( $indexing_mode eq 'dom' ) {
Link Here
|
879 |
[ '100', 'z', ' ', a => 'Tomasito' ], |
880 |
[ '100', 'z', ' ', a => 'Tomasito' ], |
880 |
[ '245', ' ', ' ', a => 'Second try' ] |
881 |
[ '245', ' ', ' ', a => 'Second try' ] |
881 |
); |
882 |
); |
882 |
C4::Search::_get_facets_data_from_record($marc_record, $facets, $facets_counter, $facets_info); |
883 |
C4::Search::_get_facets_data_from_record( $marc_record, $facets, $facets_counter ); |
883 |
is_deeply( { au => { 'Cohen Arazi, Tomas' => 2 } }, $facets_counter, |
884 |
is_deeply( { au => { 'Cohen Arazi, Tomas' => 2 } }, $facets_counter, |
884 |
"_get_facets_data_from_record correctly counts author facet twice"); |
885 |
"_get_facets_data_from_record correctly counts author facet twice"); |
885 |
|
886 |
|
|
|
887 |
# Test _get_facets_info |
888 |
my $facets_info = C4::Search::_get_facets_info( $facets ); |
889 |
my $expected_facets_info_marc21 = { |
890 |
'au' => { 'expanded' => undef, |
891 |
'label_value' => "Authors" }, |
892 |
'holdingbranch' => { 'expanded' => undef, |
893 |
'label_value' => "HoldingLibrary" }, |
894 |
'itype' => { 'expanded' => undef, |
895 |
'label_value' => "ItemTypes" }, |
896 |
'location' => { 'expanded' => undef, |
897 |
'label_value' => "Location" }, |
898 |
'se' => { 'expanded' => undef, |
899 |
'label_value' => "Series" }, |
900 |
'su-geo' => { 'expanded' => undef, |
901 |
'label_value' => "Places" }, |
902 |
'su-to' => { 'expanded' => undef, |
903 |
'label_value' => "Topics" }, |
904 |
'su-ut' => { 'expanded' => undef, |
905 |
'label_value' => "Titles" } |
906 |
}; |
907 |
is_deeply( $facets_info, $expected_facets_info_marc21, |
908 |
"_get_facets_info returns the correct data"); |
909 |
|
886 |
cleanup(); |
910 |
cleanup(); |
887 |
} |
911 |
} |
888 |
|
912 |
|
Lines 954-979
sub run_unimarc_search_tests {
Link Here
|
954 |
); |
978 |
); |
955 |
is($count, 24, 'UNIMARC authorities: hits on any starts with "jean"'); |
979 |
is($count, 24, 'UNIMARC authorities: hits on any starts with "jean"'); |
956 |
|
980 |
|
|
|
981 |
# Test _get_facets_info |
982 |
my $facets = C4::Koha::getFacets(); |
983 |
my $facets_info = C4::Search::_get_facets_info( $facets ); |
984 |
my $expected_facets_info_unimarc = { |
985 |
'au' => { 'expanded' => undef, |
986 |
'label_value' => "Authors" }, |
987 |
'holdingbranch' => { 'expanded' => undef, |
988 |
'label_value' => "HoldingLibrary" }, |
989 |
'location' => { 'expanded' => undef, |
990 |
'label_value' => "Location" }, |
991 |
'se' => { 'expanded' => undef, |
992 |
'label_value' => "Series" }, |
993 |
'su-geo' => { 'expanded' => undef, |
994 |
'label_value' => "Places" }, |
995 |
'su-to' => { 'expanded' => undef, |
996 |
'label_value' => "Topics" }, |
997 |
'su-ut' => { 'expanded' => undef, |
998 |
'label_value' => "Titles" } |
999 |
}; |
1000 |
is_deeply( $facets_info, $expected_facets_info_unimarc, |
1001 |
"_get_facets_info returns the correct data"); |
1002 |
|
957 |
cleanup(); |
1003 |
cleanup(); |
958 |
} |
1004 |
} |
959 |
|
1005 |
|
960 |
subtest 'MARC21 + GRS-1' => sub { |
1006 |
subtest 'MARC21 + GRS-1' => sub { |
961 |
plan tests => 108; |
1007 |
plan tests => 109; |
962 |
run_marc21_search_tests('grs1'); |
1008 |
run_marc21_search_tests('grs1'); |
963 |
}; |
1009 |
}; |
964 |
|
1010 |
|
965 |
subtest 'MARC21 + DOM' => sub { |
1011 |
subtest 'MARC21 + DOM' => sub { |
966 |
plan tests => 108; |
1012 |
plan tests => 109; |
967 |
run_marc21_search_tests('dom'); |
1013 |
run_marc21_search_tests('dom'); |
968 |
}; |
1014 |
}; |
969 |
|
1015 |
|
970 |
subtest 'UNIMARC + GRS-1' => sub { |
1016 |
subtest 'UNIMARC + GRS-1' => sub { |
971 |
plan tests => 13; |
1017 |
plan tests => 14; |
972 |
run_unimarc_search_tests('grs1'); |
1018 |
run_unimarc_search_tests('grs1'); |
973 |
}; |
1019 |
}; |
974 |
|
1020 |
|
975 |
subtest 'UNIMARC + DOM' => sub { |
1021 |
subtest 'UNIMARC + DOM' => sub { |
976 |
plan tests => 13; |
1022 |
plan tests => 14; |
977 |
run_unimarc_search_tests('dom'); |
1023 |
run_unimarc_search_tests('dom'); |
978 |
}; |
1024 |
}; |
979 |
|
1025 |
|
980 |
- |
|
|