Bugzilla – Attachment 193917 Details for
Bug 41931
While creating EasyAnalytics empty subfields are created
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41931: Unit tests
Bug-41931-Unit-tests.patch (text/plain), 2.35 KB, created by
Roman Dolny
on 2026-02-25 16:39:58 UTC
(
hide
)
Description:
Bug 41931: Unit tests
Filename:
MIME Type:
Creator:
Roman Dolny
Created:
2026-02-25 16:39:58 UTC
Size:
2.35 KB
patch
obsolete
>From 8d9a2241e7ce8b2bfc4c4e1d0280d8b3a655f89c Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Wed, 25 Feb 2026 15:17:16 +0000 >Subject: [PATCH] Bug 41931: Unit tests > >Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> >--- > t/db_dependent/Biblio.t | 35 ++++++++++++++++++++++++++++++++++- > 1 file changed, 34 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t >index bca89014a2..075b4b0770 100755 >--- a/t/db_dependent/Biblio.t >+++ b/t/db_dependent/Biblio.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 26; >+use Test::More tests => 27; > use Test::NoWarnings; > use Test::MockModule; > use Test::Warn; >@@ -1376,6 +1376,39 @@ subtest 'AddBiblio/ModBiblio calling ModBiblioMarc for field 005' => sub { > ok( $field && $field->data, 'Record contains field 005 after ModBiblio' ); > }; > >+subtest 'PrepHostMarcField' => sub { >+ plan tests => 3; >+ >+ my $marcflavour = 'MARC21'; >+ t::lib::Mocks::mock_preference( 'marcflavour', $marcflavour ); >+ t::lib::Mocks::mock_preference( 'EasyAnalyticalRecords ', '1' ); >+ my $barcode = 123456; >+ my $marc_host = MARC::Record->new; >+ $marc_host->insert_fields_ordered( MARC::Field->new( '245', '0', '4', a => 'The Art of MARC Cataloguing' ) ); >+ my ( $biblionumber_host, $biblioitemnumber_host ) = C4::Biblio::AddBiblio( $marc_host, '' ); >+ my $item = >+ $schema->resultset('Item') >+ ->create( >+ { biblionumber => $biblionumber_host, biblioitemnumber => $biblioitemnumber_host, barcode => $barcode } ); >+ my $itemnumber = $item->itemnumber; >+ >+ my $field_773; >+ warning_is { $field_773 = C4::Biblio::PrepHostMarcField( $biblionumber_host, $itemnumber, $marcflavour ) } undef, >+ 'No warnings in PrepHostMarcField'; >+ my $marc_anal = MARC::Record->new; >+ warning_is { $marc_anal->insert_fields_ordered($field_773) } undef, >+ 'No warnings in insert_fields_ordered'; >+ my @subfields = $field_773->subfields; >+ my @empty_subfields = (); >+ >+ for my $s (@subfields) { >+ my $code = $s->[0]; >+ my $val = $s->[1]; >+ push @empty_subfields, $code unless $val ne ''; >+ } >+ is( scalar(@empty_subfields), 0, "No empty subfields" ); >+}; >+ > # Cleanup > Koha::Caches->get_instance->clear_from_cache("MarcSubfieldStructure-"); > $schema->storage->txn_rollback; >-- >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 41931
:
193858
|
193859
|
193916
| 193917