Bug 17913: Adjust merge test for AuthorityMergeMode
Original fix from a patch on bug 11315. Amended by Marcel de Rooy January 2017. Test plan: Run t/db_dependent/Authorities/Merge.t in both loose and strict mode. Should no longer make a difference. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
79c81920ab
commit
9290e10abe
1 changed files with 14 additions and 4 deletions
|
@ -10,6 +10,7 @@ use MARC::Record;
|
|||
use Test::MockModule;
|
||||
use Test::MockObject;
|
||||
|
||||
use t::lib::Mocks;
|
||||
use t::lib::TestBuilder;
|
||||
|
||||
use C4::Biblio;
|
||||
|
@ -81,7 +82,7 @@ subtest 'Test merge A1 to A2 (within same authtype)' => sub {
|
|||
|
||||
subtest 'Test merge A1 to modified A1' => sub {
|
||||
# Tests originate from bug 11700
|
||||
plan tests => 8;
|
||||
plan tests => 9;
|
||||
|
||||
# Simulate modifying an authority from auth1old to auth1new
|
||||
my $auth1old = MARC::Record->new;
|
||||
|
@ -103,6 +104,7 @@ subtest 'Test merge A1 to modified A1' => sub {
|
|||
# Time to merge
|
||||
@zebrarecords = ( $MARC1, $MARC2 );
|
||||
$index = 0;
|
||||
t::lib::Mocks::mock_preference('AuthorityMergeMode', 'loose');
|
||||
my $rv = C4::AuthoritiesMarc::merge( $authid1, $auth1old, $authid1, $auth1new );
|
||||
is( $rv, 2, 'Both records are updated now' );
|
||||
|
||||
|
@ -117,10 +119,18 @@ subtest 'Test merge A1 to modified A1' => sub {
|
|||
compare_field_count( $MARC2, $biblio2, 1 );
|
||||
compare_field_order( $MARC2, $biblio2, 1 );
|
||||
is( $auth1new->field(109)->subfield('a'), $biblio2->field(109)->subfield('a'), 'Record2 values updated correctly' );
|
||||
# This is only true in loose mode:
|
||||
is( $biblio1->field(109)->subfield('b'), $MARC1->field(109)->subfield('b'), 'Subfield not overwritten in loose mode');
|
||||
|
||||
# TODO Following test will change when we improve merge
|
||||
# Will depend on a preference
|
||||
is( $biblio1->field(109)->subfield('b'), $MARC1->field(109)->subfield('b'), 'Record not overwritten while merging');
|
||||
# Merge again in strict mode
|
||||
t::lib::Mocks::mock_preference('AuthorityMergeMode', 'strict');
|
||||
ModBiblio( $MARC1, $biblionumber1, '' );
|
||||
@zebrarecords = ( $MARC1 );
|
||||
$index = 0;
|
||||
$rv = C4::AuthoritiesMarc::merge( $authid1, $auth1old, $authid1, $auth1new );
|
||||
$biblio1 = GetMarcBiblio($biblionumber1);
|
||||
is( $biblio1->field(109)->subfield('b'), undef, 'Subfield overwritten in strict mode' );
|
||||
t::lib::Mocks::mock_preference('AuthorityMergeMode', 'loose');
|
||||
};
|
||||
|
||||
subtest 'Test merge A1 to B1 (changing authtype)' => sub {
|
||||
|
|
Loading…
Reference in a new issue