Lines 10-15
use MARC::Record;
Link Here
|
10 |
use Test::MockModule; |
10 |
use Test::MockModule; |
11 |
use Test::MockObject; |
11 |
use Test::MockObject; |
12 |
|
12 |
|
|
|
13 |
use t::lib::Mocks; |
13 |
use t::lib::TestBuilder; |
14 |
use t::lib::TestBuilder; |
14 |
|
15 |
|
15 |
use C4::Biblio; |
16 |
use C4::Biblio; |
Lines 83-89
subtest 'Test merge A1 to A2 (within same authtype)' => sub {
Link Here
|
83 |
|
84 |
|
84 |
subtest 'Test merge A1 to modified A1' => sub { |
85 |
subtest 'Test merge A1 to modified A1' => sub { |
85 |
# Tests originate from bug 11700 |
86 |
# Tests originate from bug 11700 |
86 |
plan tests => 8; |
87 |
plan tests => 9; |
87 |
|
88 |
|
88 |
# Simulate modifying an authority from auth1old to auth1new |
89 |
# Simulate modifying an authority from auth1old to auth1new |
89 |
my $auth1old = MARC::Record->new; |
90 |
my $auth1old = MARC::Record->new; |
Lines 105-110
subtest 'Test merge A1 to modified A1' => sub {
Link Here
|
105 |
# Time to merge |
106 |
# Time to merge |
106 |
@zebrarecords = ( $MARC1, $MARC2 ); |
107 |
@zebrarecords = ( $MARC1, $MARC2 ); |
107 |
$index = 0; |
108 |
$index = 0; |
|
|
109 |
t::lib::Mocks::mock_preference('AuthorityMergeMode', 'loose'); |
108 |
my $rv = C4::AuthoritiesMarc::merge( $authid1, $auth1old, $authid1, $auth1new ); |
110 |
my $rv = C4::AuthoritiesMarc::merge( $authid1, $auth1old, $authid1, $auth1new ); |
109 |
is( $rv, 2, 'Both records are updated now' ); |
111 |
is( $rv, 2, 'Both records are updated now' ); |
110 |
|
112 |
|
Lines 119-128
subtest 'Test merge A1 to modified A1' => sub {
Link Here
|
119 |
compare_field_count( $MARC2, $biblio2, 1 ); |
121 |
compare_field_count( $MARC2, $biblio2, 1 ); |
120 |
compare_field_order( $MARC2, $biblio2, 1 ); |
122 |
compare_field_order( $MARC2, $biblio2, 1 ); |
121 |
is( $auth1new->field(109)->subfield('a'), $biblio2->field(109)->subfield('a'), 'Record2 values updated correctly' ); |
123 |
is( $auth1new->field(109)->subfield('a'), $biblio2->field(109)->subfield('a'), 'Record2 values updated correctly' ); |
|
|
124 |
# This is only true in loose mode: |
125 |
is( $biblio1->field(109)->subfield('b'), $MARC1->field(109)->subfield('b'), 'Subfield not overwritten in loose mode'); |
122 |
|
126 |
|
123 |
# TODO Following test will change when we improve merge |
127 |
# Merge again in strict mode |
124 |
# Will depend on a preference |
128 |
t::lib::Mocks::mock_preference('AuthorityMergeMode', 'strict'); |
125 |
is( $biblio1->field(109)->subfield('b'), $MARC1->field(109)->subfield('b'), 'Record not overwritten while merging'); |
129 |
ModBiblio( $MARC1, $biblionumber1, '' ); |
|
|
130 |
@zebrarecords = ( $MARC1 ); |
131 |
$index = 0; |
132 |
$rv = C4::AuthoritiesMarc::merge( $authid1, $auth1old, $authid1, $auth1new ); |
133 |
$biblio1 = GetMarcBiblio($biblionumber1); |
134 |
is( $biblio1->field(109)->subfield('b'), undef, 'Subfield overwritten in strict mode' ); |
135 |
t::lib::Mocks::mock_preference('AuthorityMergeMode', 'loose'); |
126 |
}; |
136 |
}; |
127 |
|
137 |
|
128 |
subtest 'Test merge A1 to B1 (changing authtype)' => sub { |
138 |
subtest 'Test merge A1 to B1 (changing authtype)' => sub { |
129 |
- |
|
|