Bugzilla – Attachment 183429 Details for
Bug 39054
a need to distinguish between manual bibliographic record modifications and those being a consequence of authority modification
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39054: Unit tests
Bug-39054-Unit-tests.patch (text/plain), 3.07 KB, created by
Roman Dolny
on 2025-06-24 08:15:15 UTC
(
hide
)
Description:
Bug 39054: Unit tests
Filename:
MIME Type:
Creator:
Roman Dolny
Created:
2025-06-24 08:15:15 UTC
Size:
3.07 KB
patch
obsolete
>From 45b40342a8c5617b5eb2b1fe0e1e978fb11af851 Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Mon, 23 Jun 2025 20:48:54 +0000 >Subject: [PATCH] Bug 39054: Unit tests > >Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> >--- > t/db_dependent/Authority/Merge.t | 45 +++++++++++++++++++++++++++++++- > 1 file changed, 44 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Authority/Merge.t b/t/db_dependent/Authority/Merge.t >index 209a81a0ec..8126a34f03 100755 >--- a/t/db_dependent/Authority/Merge.t >+++ b/t/db_dependent/Authority/Merge.t >@@ -4,7 +4,7 @@ > > use Modern::Perl; > use Test::NoWarnings; >-use Test::More tests => 15; >+use Test::More tests => 16; > > use Getopt::Long; > use MARC::Record; >@@ -18,6 +18,7 @@ use C4::Biblio qw( AddBiblio ModBiblio ); > use Koha::Authorities; > use Koha::Authority::ControlledIndicators; > use Koha::Authority::MergeRequests; >+use Koha::ActionLogs; > use Koha::Biblios; > use Koha::Database; > >@@ -874,6 +875,48 @@ subtest 'ModBiblio calls from merge' => sub { > > }; > >+subtest 'ModBiblio logging' => sub { >+ plan tests => 2; >+ >+ t::lib::Mocks::mock_preference( "CataloguingLog", 1 ); >+ my $mocked_module = Test::MockModule->new('C4::AuthoritiesMarc'); >+ $mocked_module->unmock('ModBiblio'); >+ >+ my $auth_record = MARC::Record->new(); >+ $auth_record->insert_fields_ordered( MARC::Field->new( '109', '1', ' ', a => 'Brown,', 'c' => 'Father' ) ); >+ my $authid = AddAuthority( $auth_record, undef, $authtype1, { skip_record_index => 1 } ); >+ >+ my $biblio_record = MARC::Record->new(); >+ $biblio_record->insert_fields_ordered( MARC::Field->new( '245', '1', '0', a => 'Adventures of Father Brown' ) ); >+ $biblio_record->insert_fields_ordered( >+ MARC::Field->new( '609', '1', '1', a => 'Brown,', 'c' => 'Father', 9 => $authid ) ); >+ my ($biblionumber) = AddBiblio( $biblio_record, '', { skip_record_index => 1 } ); >+ $biblio_record->field('245')->update( a => 'New adventures of Father Brown' ); >+ ModBiblio( $biblio_record, $biblionumber, '' ); >+ >+ my $action_logs = Koha::ActionLogs->search( >+ { object => $biblionumber, module => 'CATALOGUING' }, >+ { order_by => { -desc => 'action_id' } } >+ ); >+ my $last_action = $action_logs->next; >+ is( $last_action->action, 'MODIFY', "Performed 'real' modification of bibliographic record" ); >+ >+ $auth_record->field('109')->update( c => 'Father ; ficticous character' ); >+ ModAuthority( $authid, $auth_record, $authtype1, { skip_merge => 1 } ); >+ merge( >+ { >+ mergefrom => $authid, MARCfrom => $auth_record, mergeto => $authid, MARCto => $auth_record, >+ biblionumbers => [$biblionumber], >+ } >+ ); >+ $action_logs = Koha::ActionLogs->search( >+ { object => $biblionumber, module => 'CATALOGUING' }, >+ { order_by => { -desc => 'action_id' } } >+ ); >+ $last_action = $action_logs->next; >+ is( $last_action->action, 'MERGE', "Bibliographic record changed by C4::AuthoritiesMarc::merge" ); >+}; >+ > sub set_mocks { > > # After we removed the Zebra code from merge, we only need to mock >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39054
:
183425
|
183426
|
183427
|
183428
| 183429