Bugzilla – Attachment 169777 Details for
Bug 37380
Move GetMarcControlnumber to Koha namespace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37380: Unit tests
Bug-37380-Unit-tests.patch (text/plain), 2.40 KB, created by
Sam Lau
on 2024-07-26 19:00:33 UTC
(
hide
)
Description:
Bug 37380: Unit tests
Filename:
MIME Type:
Creator:
Sam Lau
Created:
2024-07-26 19:00:33 UTC
Size:
2.40 KB
patch
obsolete
>From ebcdc241c5fc4646f90cd644f5c9c3b683c17634 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 16 Jul 2024 15:20:20 -0300 >Subject: [PATCH] Bug 37380: Unit tests > >Signed-off-by: Sam Lau <samalau@gmail.com> >--- > .../Koha/Biblio/Metadata/Extractor/MARC.t | 53 +++++++++++++++++++ > 1 file changed, 53 insertions(+) > create mode 100755 t/db_dependent/Koha/Biblio/Metadata/Extractor/MARC.t > >diff --git a/t/db_dependent/Koha/Biblio/Metadata/Extractor/MARC.t b/t/db_dependent/Koha/Biblio/Metadata/Extractor/MARC.t >new file mode 100755 >index 0000000000..fd2140b3e9 >--- /dev/null >+++ b/t/db_dependent/Koha/Biblio/Metadata/Extractor/MARC.t >@@ -0,0 +1,53 @@ >+#!/usr/bin/perl >+ >+# Copyright 2024 Koha Development team >+# >+# 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 => 1; >+use Test::Exception; >+ >+use t::lib::TestBuilder; >+use t::lib::Mocks; >+ >+use Koha::Biblio::Metadata::Extractor; >+ >+my $schema = Koha::Database->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+subtest 'get_control_number() tests' => sub { >+ >+ plan tests => 6; >+ >+ foreach my $marcflavour (qw( MARC21 UNIMARC )) { >+ t::lib::Mocks::mock_preference( 'marcflavour', $marcflavour ); >+ >+ my $identifier = "123ASD"; >+ >+ my $record = MARC::Record->new(); >+ my $extractor = Koha::Biblio::Metadata::Extractor->new( { metadata => $record } ); >+ >+ is( $extractor->get_control_number, undef, 'Returns undef if no 001' ); >+ >+ $record->append_fields( MARC::Field->new( '001', q{} ) ); >+ is( $extractor->get_control_number, q{}, 'Returns an empty string if 001 empty' ); >+ >+ $record->field('001')->replace_with( MARC::Field->new( '001', $identifier ) ); >+ is( $extractor->get_control_number, $identifier, 'Returns the right value' ); >+ } >+}; >-- >2.39.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 37380
:
169058
|
169059
|
169060
|
169777
|
169778
|
169779
|
171099
|
171100
|
171101
|
171189
|
171190
|
171191