Lines 82-88
subtest 'Test merge A1 to A2 (within same authtype)' => sub {
Link Here
|
82 |
|
82 |
|
83 |
subtest 'Test merge A1 to modified A1' => sub { |
83 |
subtest 'Test merge A1 to modified A1' => sub { |
84 |
# Tests originate from bug 11700 |
84 |
# Tests originate from bug 11700 |
85 |
plan tests => 9; |
85 |
plan tests => 11; |
86 |
|
86 |
|
87 |
# Simulate modifying an authority from auth1old to auth1new |
87 |
# Simulate modifying an authority from auth1old to auth1new |
88 |
my $auth1old = MARC::Record->new; |
88 |
my $auth1old = MARC::Record->new; |
Lines 95-100
subtest 'Test merge A1 to modified A1' => sub {
Link Here
|
95 |
my $MARC1 = MARC::Record->new; |
95 |
my $MARC1 = MARC::Record->new; |
96 |
$MARC1->append_fields( MARC::Field->new( '109', '', '', 'a' => 'Bruce Wayne', 'b' => '2014', '9' => $authid1 )); |
96 |
$MARC1->append_fields( MARC::Field->new( '109', '', '', 'a' => 'Bruce Wayne', 'b' => '2014', '9' => $authid1 )); |
97 |
$MARC1->append_fields( MARC::Field->new( '245', '', '', 'a' => 'From the depths' )); |
97 |
$MARC1->append_fields( MARC::Field->new( '245', '', '', 'a' => 'From the depths' )); |
|
|
98 |
$MARC1->append_fields( MARC::Field->new( '609', '', '', 'a' => 'Bruce Lee', 'b' => 'Should be cleared too', '9' => $authid1 )); |
99 |
$MARC1->append_fields( MARC::Field->new( '609', '', '', 'a' => 'Bruce Lee', 'c' => 'This is a duplicate to be removed in strict mode', '9' => $authid1 )); |
98 |
my $MARC2 = MARC::Record->new; |
100 |
my $MARC2 = MARC::Record->new; |
99 |
$MARC2->append_fields( MARC::Field->new( '109', '', '', 'a' => 'Batman', '9' => $authid1 )); |
101 |
$MARC2->append_fields( MARC::Field->new( '109', '', '', 'a' => 'Batman', '9' => $authid1 )); |
100 |
$MARC2->append_fields( MARC::Field->new( '245', '', '', 'a' => 'All the way to heaven' )); |
102 |
$MARC2->append_fields( MARC::Field->new( '245', '', '', 'a' => 'All the way to heaven' )); |
Lines 128-133
subtest 'Test merge A1 to modified A1' => sub {
Link Here
|
128 |
$rv = C4::AuthoritiesMarc::merge( $authid1, $auth1old, $authid1, $auth1new ); |
130 |
$rv = C4::AuthoritiesMarc::merge( $authid1, $auth1old, $authid1, $auth1new ); |
129 |
$biblio1 = GetMarcBiblio($biblionumber1); |
131 |
$biblio1 = GetMarcBiblio($biblionumber1); |
130 |
is( $biblio1->field(109)->subfield('b'), undef, 'Subfield overwritten in strict mode' ); |
132 |
is( $biblio1->field(109)->subfield('b'), undef, 'Subfield overwritten in strict mode' ); |
|
|
133 |
is( $biblio1->fields, scalar( $MARC1->fields ) - 1, 'strict mode should remove a duplicate 609' ); |
134 |
is( $biblio1->field(609)->subfields, |
135 |
scalar($auth1new->field('109')->subfields) + 1, |
136 |
'Check number of subfields in strict mode for the remaining 609' ); |
137 |
# Note: the +1 comes from the added subfield $9 in the biblio |
131 |
t::lib::Mocks::mock_preference('AuthorityMergeMode', 'loose'); |
138 |
t::lib::Mocks::mock_preference('AuthorityMergeMode', 'loose'); |
132 |
}; |
139 |
}; |
133 |
|
140 |
|
134 |
- |
|
|