3 # This Koha test module is a stub!
4 # Add more tests here!!!
9 use Test::More tests => 10;
13 use_ok('C4::Heading', qw( field new_from_field display_form search_form ));
17 skip "MARC21 heading tests not applicable to UNIMARC", 2 if C4::Context->preference('marcflavour') eq 'UNIMARC';
18 my $field = MARC::Field->new( '650', ' ', '2', a => 'Uncles', x => 'Fiction' );
19 my $heading = C4::Heading->new_from_field($field);
20 is($heading->display_form(), 'Uncles--Fiction', 'Display form generation');
21 is($heading->search_form(), 'Uncles generalsubdiv Fiction', 'Search form generation');
22 is($heading->{thesaurus}, 'mesh', 'Thesaurus generation');
24 $field = MARC::Field->new( '830', ' ', '4', a => 'The dark is rising ;', v => '3' );
25 $heading = C4::Heading->new_from_field($field);
26 is($heading->display_form(), 'The dark is rising ;', 'Display form generation');
27 is($heading->search_form(), 'The dark is rising', 'Search form generation');
28 ok( !defined $heading->{thesaurus}, 'Thesaurus is not generated outside of 6XX fields');
30 $field = MARC::Field->new( '100', '1', '', a => 'Yankovic, Al', d => '1959-' );
31 $heading = C4::Heading->new_from_field($field);
32 is($heading->display_form(), 'Yankovic, Al 1959-', 'Display form generation');
33 is($heading->search_form(), 'Yankovic, Al 1959', 'Search form generation');
34 ok( !defined $heading->{thesaurus}, 'Thesaurus is not generated outside of 6XX fields');