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

(-)a/C4/Heading/MARC21.pm (-1 / +2 lines)
Lines 411-417 sub _get_search_heading { Link Here
411
            $heading = $value;
411
            $heading = $value;
412
        }
412
        }
413
        else {
413
        else {
414
            if ( exists $subdivisions{$code} ) {
414
            if ( exists $subdivisions{$code}
415
                && C4::Context->preference('SearchEngine') eq 'Zebra' ) {
415
                $heading .= " $subdivisions{$code} $value";
416
                $heading .= " $subdivisions{$code} $value";
416
            }
417
            }
417
            else {
418
            else {
(-)a/C4/Heading/UNIMARC.pm (-1 / +2 lines)
Lines 166-172 sub _get_search_heading { Link Here
166
            $heading = $value;
166
            $heading = $value;
167
        }
167
        }
168
        else {
168
        else {
169
            if ( exists $subdivisions{$code} ) {
169
            if ( exists $subdivisions{$code}
170
                && C4::Context->preference('SearchEngine') eq 'Zebra' ) {
170
                $heading .= " $subdivisions{$code} $value";
171
                $heading .= " $subdivisions{$code} $value";
171
            }
172
            }
172
            else {
173
            else {
(-)a/t/db_dependent/Heading_MARC21.t (-4 / +43 lines)
Lines 7-20 use strict; Link Here
7
use warnings;
7
use warnings;
8
8
9
use Test::More tests => 5;
9
use Test::More tests => 5;
10
use t::lib::Mocks qw( mock_preference );
10
use C4::Context;
11
use C4::Context;
11
12
12
BEGIN {
13
BEGIN {
13
        use_ok('C4::Heading', qw( field new_from_field display_form search_form ));
14
        use_ok('C4::Heading', qw( field new_from_field display_form search_form ));
14
}
15
}
15
16
16
SKIP: {
17
subtest 'Search MARC21 heading with Zebra search engine' => sub {
17
    skip "MARC21 heading tests not applicable to UNIMARC", 2 if C4::Context->preference('marcflavour') eq 'UNIMARC';
18
    plan tests => 4;
19
20
    t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' );
21
    t::lib::Mocks::mock_preference( 'SearchEngine', 'Zebra' );
22
18
    my $field = MARC::Field->new( '650', ' ', '0', a => 'Uncles', x => 'Fiction' );
23
    my $field = MARC::Field->new( '650', ' ', '0', a => 'Uncles', x => 'Fiction' );
19
    my $heading = C4::Heading->new_from_field($field);
24
    my $heading = C4::Heading->new_from_field($field);
20
    is($heading->display_form(), 'Uncles--Fiction', 'Display form generation');
25
    is($heading->display_form(), 'Uncles--Fiction', 'Display form generation');
Lines 24-28 SKIP: { Link Here
24
    $heading = C4::Heading->new_from_field($field);
29
    $heading = C4::Heading->new_from_field($field);
25
    is($heading->display_form(), 'The dark is rising ;', 'Display form generation');
30
    is($heading->display_form(), 'The dark is rising ;', 'Display form generation');
26
    is($heading->search_form(), 'The dark is rising', 'Search form generation');
31
    is($heading->search_form(), 'The dark is rising', 'Search form generation');
32
};
27
33
28
}
34
subtest 'Search UNIMARC heading with Zebra search engine' => sub {
35
    plan tests => 2;
36
37
    t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' );
38
    t::lib::Mocks::mock_preference( 'SearchEngine', 'Zebra' );
39
40
    my $field = MARC::Field->new( '650', ' ', '0', a => 'Uncles', x => 'Fiction' );
41
    my $heading = C4::Heading->new_from_field($field);
42
    is($heading->display_form(), 'Uncles--Fiction', 'Display form generation');
43
    is($heading->search_form(), 'Uncles generalsubdiv Fiction', 'Search form generation');
44
};
45
46
subtest 'Search MARC21 heading with Elasticsearch search engine' => sub {
47
    plan tests => 2;
48
49
    t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' );
50
    t::lib::Mocks::mock_preference( 'SearchEngine', 'Elasticsearch' );
51
52
    my $field = MARC::Field->new( '650', ' ', '0', a => 'Uncles', x => 'Fiction' );
53
    my $heading = C4::Heading->new_from_field($field);
54
    is($heading->display_form(), 'Uncles--Fiction', 'Display form generation');
55
    is($heading->search_form(), 'Uncles Fiction', 'Search form generation');
56
};
57
58
subtest 'Search UNIMARC heading with Elasticsearch search engine' => sub {
59
    plan tests => 2;
60
61
    t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' );
62
    t::lib::Mocks::mock_preference( 'SearchEngine', 'Elasticsearch' );
63
64
    my $field = MARC::Field->new( '650', ' ', '0', a => 'Uncles', x => 'Fiction' );
65
    my $heading = C4::Heading->new_from_field($field);
66
    is($heading->display_form(), 'Uncles--Fiction', 'Display form generation');
67
    is($heading->search_form(), 'Uncles Fiction', 'Search form generation');
68
};
29
- 

Return to bug 29191