Lines 4-14
Link Here
|
4 |
|
4 |
|
5 |
use Modern::Perl; |
5 |
use Modern::Perl; |
6 |
|
6 |
|
7 |
use Test::More tests => 11; |
7 |
use Test::More tests => 12; |
8 |
|
8 |
|
9 |
use Getopt::Long; |
9 |
use Getopt::Long; |
10 |
use MARC::Record; |
10 |
use MARC::Record; |
11 |
use Test::MockModule; |
11 |
use Test::MockModule; |
|
|
12 |
use Test::Warn; |
12 |
|
13 |
|
13 |
use t::lib::Mocks; |
14 |
use t::lib::Mocks; |
14 |
use t::lib::TestBuilder; |
15 |
use t::lib::TestBuilder; |
Lines 516-521
subtest 'Test how merge handles controlled indicators' => sub {
Link Here
|
516 |
is( $biblio2->subfield('609', '2'), undef, 'No subfield $2 left' ); |
517 |
is( $biblio2->subfield('609', '2'), undef, 'No subfield $2 left' ); |
517 |
}; |
518 |
}; |
518 |
|
519 |
|
|
|
520 |
subtest "Test bibs not auto linked when merging" => sub { |
521 |
plan tests => 1; |
522 |
|
523 |
my $authmarc = MARC::Record->new; |
524 |
$authmarc->append_fields( MARC::Field->new( '109', '', '', 'a' => 'aa', b => 'bb' ) ); |
525 |
my $oldauthmarc = MARC::Record->new; |
526 |
$oldauthmarc->append_fields( MARC::Field->new( '112', '', '', c => 'cc' ) ); |
527 |
my $new_id = AddAuthority( $authmarc, undef, $authtype1 ); |
528 |
my $old_id = AddAuthority( $oldauthmarc, undef, $authtype1 ); |
529 |
my $biblio = MARC::Record->new; |
530 |
$biblio->append_fields( |
531 |
MARC::Field->new( '109', '', '', a => 'a1', 9 => $old_id ), |
532 |
MARC::Field->new( '612', '', '', a => 'a2', c => 'cc', 9 => $old_id ), |
533 |
); |
534 |
my ($biblionumber) = C4::Biblio::AddBiblio( $biblio, '' ); |
535 |
|
536 |
my $biblio_module = Test::MockModule->new('C4::AuthoritiesMarc'); |
537 |
$biblio_module->mock( |
538 |
'ModBiblio', |
539 |
sub { |
540 |
my ( undef, undef, undef, $params ) = @_; |
541 |
warn "Auto link disabled" if $params->{disable_autolink}; |
542 |
} |
543 |
); |
544 |
|
545 |
warnings_are { |
546 |
merge( |
547 |
{ |
548 |
mergefrom => $old_id, MARCfrom => $oldauthmarc, mergeto => $new_id, MARCto => $authmarc, |
549 |
biblionumbers => [$biblionumber] |
550 |
} |
551 |
); |
552 |
} |
553 |
["Auto link disabled"], "Auto link disabled when merging authorities"; |
554 |
|
555 |
}; |
556 |
|
519 |
sub set_mocks { |
557 |
sub set_mocks { |
520 |
# After we removed the Zebra code from merge, we only need to mock |
558 |
# After we removed the Zebra code from merge, we only need to mock |
521 |
# get_usage_count and linked_biblionumbers here. |
559 |
# get_usage_count and linked_biblionumbers here. |
522 |
- |
|
|