View | Details | Raw Unified | Return to bug 22437
Collapse All | Expand All

(-)a/t/db_dependent/Authority/Merge.t (-2 / +15 lines)
Lines 288-294 subtest 'Merging authorities should handle deletes (BZ 18070)' => sub { Link Here
288
};
288
};
289
289
290
subtest "Test some specific postponed merge issues" => sub {
290
subtest "Test some specific postponed merge issues" => sub {
291
    plan tests => 4;
291
    plan tests => 5;
292
292
293
    my $authmarc = MARC::Record->new;
293
    my $authmarc = MARC::Record->new;
294
    $authmarc->append_fields( MARC::Field->new( '109', '', '', 'a' => 'aa', b => 'bb' ));
294
    $authmarc->append_fields( MARC::Field->new( '109', '', '', 'a' => 'aa', b => 'bb' ));
Lines 328-333 subtest "Test some specific postponed merge issues" => sub { Link Here
328
    $restored_mocks->{auth_mod}->unmock_all;
328
    $restored_mocks->{auth_mod}->unmock_all;
329
    $biblio = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
329
    $biblio = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
330
    is( $biblio->subfield('109', '9'), $id, 'If the 109 is no longer present, another modify merge would not bring it back' );
330
    is( $biblio->subfield('109', '9'), $id, 'If the 109 is no longer present, another modify merge would not bring it back' );
331
    # Bug 22437 however presented scenario C->B, B->A (B and A should have linkcount>limit)
332
    # This results in: postponed merge B->B, run merge C->B, delete C, and postponed A->A, postponed B->A, delete B
333
    # Showing what happens if merge.pl did not remove the B->B merge from the queue
334
    t::lib::Mocks::mock_preference('AuthorityMergeLimit', 2);
335
    @linkedrecords = ( 1, 2, 3 ); # these biblionumbers do not matter, count>=2
336
    $id = AddAuthority( $authmarc, undef, $authtype1 ); # this is B
337
    $biblio->delete_fields( $biblio->field('109') ); # cleanup
338
    $biblio->append_fields( MARC::Field->new( '109', '', '', a => 'a', 9 => $id ) ); # a biblio connected to B
339
    ModBiblio( $biblio, $biblionumber, '' );
340
    DelAuthority({ authid => $id, skip_merge => 1 }); # delete B when doing B->A
341
    merge({ mergefrom => $id, mergeto => $id, MARCto => undef, biblionumbers => [ $biblionumber ] }); # destructive B->B from cron
342
    $biblio = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
343
    my @fields = $biblio->field('109');
344
    is( scalar @fields, 0, 'No field 109: the B,B merge was destructive, so needs to be removed.' );
331
};
345
};
332
346
333
subtest "Graceful resolution of missing reporting tag" => sub {
347
subtest "Graceful resolution of missing reporting tag" => sub {
334
- 

Return to bug 22437