Bugzilla – Attachment 71085 Details for
Bug 18198
MARC21: Further improve handling of 5XX$u in GetMarcNotes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18198: (QA follow-up) Add tests for GetMarcNotes
Bug-18198-QA-follow-up-Add-tests-for-GetMarcNotes.patch (text/plain), 2.96 KB, created by
Marcel de Rooy
on 2018-01-31 12:57:50 UTC
(
hide
)
Description:
Bug 18198: (QA follow-up) Add tests for GetMarcNotes
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-01-31 12:57:50 UTC
Size:
2.96 KB
patch
obsolete
>From 8f8e51da147cc887ab7f6fe41ef34681fcac3169 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 31 Jan 2018 13:52:46 +0100 >Subject: [PATCH] Bug 18198: (QA follow-up) Add tests for GetMarcNotes >Content-Type: text/plain; charset=utf-8 > >As requested by the RM, this patch adds a separate unit test >for GetMarcNotes. We test MARC21 and UNIMARC. The NotesBlacklist pref >is tested and also handling URLs in 5XX$u for MARC21. > >Test plan: >Run t/Biblio/GetMarcNotes.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/Biblio/GetMarcNotes.t | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 59 insertions(+) > create mode 100755 t/Biblio/GetMarcNotes.t > >diff --git a/t/Biblio/GetMarcNotes.t b/t/Biblio/GetMarcNotes.t >new file mode 100755 >index 0000000..6068dcd >--- /dev/null >+++ b/t/Biblio/GetMarcNotes.t >@@ -0,0 +1,59 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Test::More tests => 2; >+use t::lib::Mocks; >+ >+use MARC::Field; >+use MARC::Record; >+ >+use C4::Biblio; >+ >+subtest 'GetMarcNotes MARC21' => sub { >+ plan tests => 4; >+ t::lib::Mocks::mock_preference( 'NotesBlacklist', '520' ); >+ >+ my $record = MARC::Record->new; >+ $record->append_fields( >+ MARC::Field->new( '500', '', '', a => 'Note1' ), >+ MARC::Field->new( '505', '', '', a => 'Note2', u => 'http://someserver.com' ), >+ MARC::Field->new( '520', '', '', a => 'Note3 skipped' ), >+ ); >+ my $notes = C4::Biblio::GetMarcNotes( $record, 'MARC21' ); >+ is( $notes->[0]->{marcnote}, 'Note1', 'First note' ); >+ is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); >+ is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' ); >+ is( @$notes, 3, 'No more notes' ); >+}; >+ >+subtest 'GetMarcNotes UNIMARC' => sub { >+ plan tests => 3; >+ t::lib::Mocks::mock_preference( 'NotesBlacklist', '310' ); >+ >+ my $record = MARC::Record->new; >+ $record->append_fields( >+ MARC::Field->new( '300', '', '', a => 'Note1' ), >+ MARC::Field->new( '300', '', '', a => 'Note2' ), >+ MARC::Field->new( '310', '', '', a => 'Note3 skipped' ), >+ ); >+ my $notes = C4::Biblio::GetMarcNotes( $record, 'UNIMARC' ); >+ is( $notes->[0]->{marcnote}, 'Note1', 'First note' ); >+ is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); >+ is( @$notes, 2, 'No more notes' ); >+}; >-- >2.1.4
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 18198
:
60790
|
68170
|
70941
| 71085