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