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 |
- |
|
|