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