Koha/t/db_dependent/Heading_MARC21.t
Nick Clemens d4783f244b
Bug 24269: Adjust C4::Heading to generate headings from auth tags
To test:
1 - Be using Elasticsearch
2 - Check that field 150 is mapped to 'Match-heading' or add it (the subfields don't matter)
3 - Add a topic term authority record like "150 $aCats$vFiction"
4 - Add a 650 with $aCats and $vFiction and  $e depicted to a bibliographic record
5 - Run the linker for the bib
    perl misc/link_bibs_to_authorities.pl --bib-limit "biblionumber=89" -v
6 - Confirm the record is not correctly linked to the record
7 - Apply patch
8 - Reindex authorities for ES
    perl misc/search_tools/rebuild_elasticsearch.pl -v -d -a
9 - Run the linker and confirm record is correctly linked
    perl misc/link_bibs_to_authorities.pl --bib-limit "biblionumber=89" -v

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-19 13:33:32 +00:00

28 lines
941 B
Perl
Executable file

#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 5;
use C4::Context;
BEGIN {
use_ok('C4::Heading');
}
SKIP: {
skip "MARC21 heading tests not applicable to UNIMARC", 2 if C4::Context->preference('marcflavour') eq 'UNIMARC';
my $field = MARC::Field->new( '650', ' ', '0', a => 'Uncles', x => 'Fiction' );
my $heading = C4::Heading->new_from_field($field);
is($heading->display_form(), 'Uncles--Fiction', 'Display form generation');
is($heading->search_form(), 'Uncles generalsubdiv Fiction', 'Search form generation');
$field = MARC::Field->new( '830', ' ', '4', a => 'The dark is rising ;', v => '3' );
$heading = C4::Heading->new_from_field($field);
is($heading->display_form(), 'The dark is rising ;', 'Display form generation');
is($heading->search_form(), 'The dark is rising', 'Search form generation');
}