From 361ec4b2ea1873cd65fce8248218fe685ee354e7 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Thu, 30 May 2024 08:22:08 +0000 Subject: [PATCH] Bug 35989: (QA follow-up): Fix QA tests Some file tidying to pass the QA tests Signed-off-by: Aleisha Amohia Signed-off-by: Martin Renvoize --- C4/AuthoritiesMarc.pm | 6 +-- t/db_dependent/AuthoritiesMarc.t | 70 +++++++++++++++++--------------- 2 files changed, 40 insertions(+), 36 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 4c61f8bedb..1656a2ba9b 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -1009,9 +1009,9 @@ sub BuildSummary { } } $record->field('7..'); } else { -# construct MARC21 summary -# FIXME - looping over 1XX is questionable -# since MARC21 authority should have only one 1XX + # construct MARC21 summary + # FIXME - looping over 1XX is questionable + # since MARC21 authority should have only one 1XX use C4::Heading::MARC21; my $handler = C4::Heading::MARC21->new(); my $subfields_to_report; diff --git a/t/db_dependent/AuthoritiesMarc.t b/t/db_dependent/AuthoritiesMarc.t index e1b117fbc6..55435d281b 100755 --- a/t/db_dependent/AuthoritiesMarc.t +++ b/t/db_dependent/AuthoritiesMarc.t @@ -29,44 +29,48 @@ $module->mock('GetHeaderAuthority', sub { $module->mock('AddAuthorityTrees', sub { return; }); -$module->mock('GetAuthority', sub { - my ($authid) = @_; - my $record = MARC::Record->new(); - if ($authid eq '1') { - $record->add_fields( - [ '001', '1' ], - [ '151', ' ', ' ', a => 'United States' ] +$module->mock( + 'GetAuthority', + sub { + my ($authid) = @_; + my $record = MARC::Record->new(); + if ( $authid eq '1' ) { + $record->add_fields( + [ '001', '1' ], + [ '151', ' ', ' ', a => 'United States' ] + ); + } elsif ( $authid eq '2' ) { + $record->add_fields( + [ '001', '2' ], + [ '151', ' ', ' ', a => 'New York (State)' ], + [ '551', ' ', ' ', a => 'United States', w => 'g', 9 => '1' ], + [ '751', ' ', ' ', a => 'United States', w => 'g', 9 => '1' ], + [ '781', ' ', ' ', a => 'New York', x => 'General subdivision', 9 => '1' ] ); - } elsif ($authid eq '2') { - $record->add_fields( - [ '001', '2' ], - [ '151', ' ', ' ', a => 'New York (State)' ], - [ '551', ' ', ' ', a => 'United States', w => 'g', 9 => '1' ], - [ '751', ' ', ' ', a => 'United States', w => 'g', 9 => '1' ], - [ '781', ' ', ' ', a => 'New York', x => 'General subdivision', 9 => '1' ] - ); - } elsif ($authid eq '3') { - $record->add_fields( - [ '001', '3' ], - [ '151', ' ', ' ', a => 'New York (City)' ], - [ '551', ' ', ' ', a => 'New York (State)', w => 'g', 9 => '2' ] + } elsif ( $authid eq '3' ) { + $record->add_fields( + [ '001', '3' ], + [ '151', ' ', ' ', a => 'New York (City)' ], + [ '551', ' ', ' ', a => 'New York (State)', w => 'g', 9 => '2' ] ); - } elsif ($authid eq '4') { - $record->add_fields( - [ '001', '4' ], - [ '151', ' ', ' ', a => 'New York (City)' ], - [ '551', ' ', ' ', a => 'New York (State)', w => 'g' ] + } elsif ( $authid eq '4' ) { + $record->add_fields( + [ '001', '4' ], + [ '151', ' ', ' ', a => 'New York (City)' ], + [ '551', ' ', ' ', a => 'New York (State)', w => 'g' ] ); - } elsif ($authid eq '5') { - $record->add_fields( - [ '001', '5' ], - [ '100', ' ', ' ', a => 'Lastname, Firstname', b => 'b', c => 'c', i => 'i' ] + } elsif ( $authid eq '5' ) { + $record->add_fields( + [ '001', '5' ], + [ '100', ' ', ' ', a => 'Lastname, Firstname', b => 'b', c => 'c', i => 'i' ] ); - } else { - undef $record; + } else { + undef $record; + } + return $record; } - return $record; -}); +); + my $schema = Koha::Database->new->schema; $schema->storage->txn_begin; -- 2.39.5