Lines 4-10
Link Here
|
4 |
|
4 |
|
5 |
use Modern::Perl; |
5 |
use Modern::Perl; |
6 |
|
6 |
|
7 |
use Test::More tests => 8; |
7 |
use Test::More tests => 9; |
8 |
|
8 |
|
9 |
use Getopt::Long; |
9 |
use Getopt::Long; |
10 |
use MARC::Record; |
10 |
use MARC::Record; |
Lines 360-365
subtest "Graceful resolution of missing reporting tag" => sub {
Link Here
|
360 |
$fw2->auth_tag_to_report('112')->store; |
360 |
$fw2->auth_tag_to_report('112')->store; |
361 |
}; |
361 |
}; |
362 |
|
362 |
|
|
|
363 |
subtest 'merge should not reorder too much' => sub { |
364 |
plan tests => 2; |
365 |
|
366 |
# Back to loose mode |
367 |
t::lib::Mocks::mock_preference('AuthorityMergeMode', 'loose'); |
368 |
|
369 |
my $authmarc = MARC::Record->new; |
370 |
$authmarc->append_fields( MARC::Field->new( '109', '', '', 'a' => 'aa', b => 'bb' )); |
371 |
my $id = AddAuthority( $authmarc, undef, $authtype1 ); |
372 |
my $biblio = MARC::Record->new; |
373 |
$biblio->append_fields( |
374 |
MARC::Field->new( '109', '', '', 9 => $id, i => 'in front', a => 'aa', c => 'after controlled block' ), # this field shows the old situation when $9 is the first subfield |
375 |
MARC::Field->new( '609', '', '', i => 'in front', a => 'aa', c => 'after controlled block', 9 => $id ), # here $9 is already the last one |
376 |
); |
377 |
my ( $biblionumber ) = C4::Biblio::AddBiblio( $biblio, '' ); |
378 |
|
379 |
# Merge 109 and 609 and check order of subfields |
380 |
merge({ mergefrom => $id, MARCfrom => $authmarc, mergeto => $id, MARCto => $authmarc, biblionumbers => [ $biblionumber ] }); |
381 |
my $biblio2 = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); |
382 |
my $subfields = [ map { $_->[0] } $biblio2->field('109')->subfields ]; |
383 |
is_deeply( $subfields, [ 'i', 'a', 'b', 'c', '9' ], 'Merge only moved $9' ); |
384 |
$subfields = [ map { $_->[0] } $biblio2->field('609')->subfields ]; |
385 |
is_deeply( $subfields, [ 'i', 'a', 'b', 'c', '9' ], 'Order kept' ); |
386 |
}; |
387 |
|
363 |
sub set_mocks { |
388 |
sub set_mocks { |
364 |
# After we removed the Zebra code from merge, we only need to mock |
389 |
# After we removed the Zebra code from merge, we only need to mock |
365 |
# get_usage_count and linked_biblionumbers here. |
390 |
# get_usage_count and linked_biblionumbers here. |
366 |
- |
|
|