Bugzilla – Attachment 166525 Details for
Bug 30047
Add a field to auth_header to record main heading as text string
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30047: Unit tests
Bug-30047-Unit-tests.patch (text/plain), 3.58 KB, created by
Marcel de Rooy
on 2024-05-10 09:52:30 UTC
(
hide
)
Description:
Bug 30047: Unit tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-05-10 09:52:30 UTC
Size:
3.58 KB
patch
obsolete
>From 3ed9ef12be5d952cec991be7af4cc18570f26234 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 19 Jan 2024 14:24:25 +0000 >Subject: [PATCH] Bug 30047: Unit tests >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/AuthoritiesMarc.t | 47 +++++++++++++++++++++++++++++--- > 1 file changed, 43 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/AuthoritiesMarc.t b/t/db_dependent/AuthoritiesMarc.t >index 5f5c86f2c6..3823dd9d5c 100755 >--- a/t/db_dependent/AuthoritiesMarc.t >+++ b/t/db_dependent/AuthoritiesMarc.t >@@ -5,7 +5,7 @@ > > use Modern::Perl; > >-use Test::More tests => 12; >+use Test::More tests => 13; > use Test::MockModule; > use Test::Warn; > use MARC::Field; >@@ -175,6 +175,12 @@ $dbh->do(q{ > INSERT INTO auth_types (authtypecode, authtypetext, auth_tag_to_report, summary) > VALUES ('NP', 'Auteur', '200', '[200a][, 200b][ 200d][ ; 200c][ (200f)]') > }); >+$dbh->do( >+ q{ >+ INSERT INTO marc_subfield_structure (frameworkcode,authtypecode,tagfield) >+ VALUES ('','NP','200') >+} >+); > > my $unimarc_name_auth = MARC::Record->new(); > $unimarc_name_auth->add_fields( >@@ -212,17 +218,50 @@ subtest 'AddAuthority should respect AUTO_INCREMENT (BZ 18104)' => sub { > plan tests => 3; > > t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' ); >- my $record = C4::AuthoritiesMarc::GetAuthority(1); >+ my $record = MARC::Record->new(); >+ my $field = MARC::Field->new( '151', ' ', ' ', a => 'Amsterdam (Netherlands)', 'x' => 'Economic conditions' ); >+ $record->append_fields($field); > my $id1 = AddAuthority( $record, undef, 'GEOGR_NAME' ); >- DelAuthority({ authid => $id1 }); >+ DelAuthority( { authid => $id1 } ); >+ $record = MARC::Record->new(); >+ $record->append_fields($field); > my $id2 = AddAuthority( $record, undef, 'GEOGR_NAME' ); > isnt( $id1, $id2, 'Do not return the same id again' ); > t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' ); >- my $id3 = AddAuthority( $record, undef, 'GEOGR_NAME' ); >+ $record = MARC::Record->new(); >+ $field = MARC::Field->new( '200', ' ', ' ', a => 'Fossey', 'b' => 'Brigitte' ); >+ $record->append_fields($field); >+ my $id3 = AddAuthority( $record, undef, 'NP' ); > ok( $id3 > 0, 'Tested AddAuthority with UNIMARC' ); > is( $record->field('001')->data, $id3, 'Check updated 001' ); > }; > >+subtest 'AddAuthority should create heading field with display form' => sub { >+ plan tests => 2; >+ >+ t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' ); >+ t::lib::Mocks::mock_preference( 'AuthoritiesLog', 0 ); >+ my $record = MARC::Record->new(); >+ my $field = MARC::Field->new( '151', ' ', ' ', a => 'White River Junction (Vt.)' ); >+ $record->append_fields($field); >+ my $id = AddAuthority( $record, undef, 'GEOGR_NAME' ); >+ my $authority = Koha::Authorities->find($id); >+ is( >+ $authority->heading, 'White River Junction (Vt.)', >+ 'Heading field is formed as expected when adding authority' >+ ); >+ $record = MARC::Record->new(); >+ $field = MARC::Field->new( '151', ' ', ' ', a => 'Lyon (France)', 'x' => 'Antiquities' ); >+ $record->append_fields($field); >+ $id = ModAuthority( $id, $record, 'GEOGR_NAME' ); >+ $authority = Koha::Authorities->find($id); >+ is( >+ $authority->heading, 'Lyon (France)--Antiquities', >+ 'Heading field is formed as expected when modding authority' >+ ); >+ >+}; >+ > subtest 'CompareFieldWithAuthority tests' => sub { > plan tests => 3; > >-- >2.30.2
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 30047
:
161208
|
161209
|
161210
|
161211
|
161213
|
161214
|
161215
|
161216
|
166522
|
166523
|
166524
| 166525 |
166644