Bugzilla – Attachment 137234 Details for
Bug 15187
Adding 880 Fields to index-list in order to Increase Search for ALL non-latin Scripts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15187: (QA follow-up) Add unit test
Bug-15187-QA-follow-up-Add-unit-test.patch (text/plain), 3.48 KB, created by
Martin Renvoize (ashimema)
on 2022-07-06 17:08:21 UTC
(
hide
)
Description:
Bug 15187: (QA follow-up) Add unit test
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-07-06 17:08:21 UTC
Size:
3.48 KB
patch
obsolete
>From 7e619051212c7b7b004474541838e8501101e28d Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 6 Jul 2022 12:52:05 +0100 >Subject: [PATCH] Bug 15187: (QA follow-up) Add unit test > >This patch adds a unit test for the newly introduced filter. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Koha/Filter/Index880InZebra.t | 74 ++++++++++++++++++++ > 1 file changed, 74 insertions(+) > create mode 100644 t/db_dependent/Koha/Filter/Index880InZebra.t > >diff --git a/t/db_dependent/Koha/Filter/Index880InZebra.t b/t/db_dependent/Koha/Filter/Index880InZebra.t >new file mode 100644 >index 0000000000..52ba21e259 >--- /dev/null >+++ b/t/db_dependent/Koha/Filter/Index880InZebra.t >@@ -0,0 +1,74 @@ >+#!/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 utf8; >+use Modern::Perl; >+ >+use Test::More tests => 1; >+ >+use t::lib::TestBuilder; >+ >+use Koha::Database; >+use Koha::RecordProcessor; >+ >+my $schema = Koha::Database->schema(); >+my $builder = t::lib::TestBuilder->new(); >+ >+subtest 'Index880InZebra tests' => sub { >+ >+ plan tests => 10; >+ >+ $schema->storage->txn_begin(); >+ >+ # Add a biblio >+ my $biblio = $builder->build_sample_biblio({ title => 'Pastoral epistles' }); >+ my $record = $biblio->metadata->record; >+ >+ # Add an 880 alternate >+ $record->append_fields( >+ MARC::Field->new( '880', '', '', 6 => '245-01', a => 'æç§æ¸ä¿¡' ), >+ ); >+ >+ my @fields_245 = $record->field('245'); >+ is( @fields_245, 1, 'One title (245) field present before filtering'); >+ is( $fields_245[0]->subfield('a'), 'Pastoral epistles', 'First 245 contains english title before filtering'); >+ >+ my @fields_880 = $record->field('880'); >+ is( @fields_880, 1, 'One alternate graphic represnetation (880) field present before filtering'); >+ is( $fields_880[0]->subfield('a'), 'æç§æ¸ä¿¡', 'Alternate graphic represnations contains chinese characters prior to filtering' ); >+ >+ my $processor = Koha::RecordProcessor->new( >+ { >+ schema => 'MARC', >+ filters => ['Index880InZebra'], >+ } >+ ); >+ is( ref($processor), 'Koha::RecordProcessor', 'Created record processor with Index880InZebra filter' ); >+ >+ my $result = $processor->process( $record ); >+ is( ref($result), 'MARC::Record', 'It returns a reference to a MARC::Record object' ); >+ >+ @fields_245 = $result->field('245'); >+ is( @fields_245, 2, 'Two title (245) fields present after filtering'); >+ is( $fields_245[0]->subfield('a'), 'Pastoral epistles', 'First 245 contains english title after filtering'); >+ is( $fields_245[1]->subfield('a'), 'æç§æ¸ä¿¡', 'Second 245 contains chinese title from 880 after filtering' ); >+ >+ @fields_880 = $result->field('880'); >+ is( @fields_880, 0, 'No alternate graphic represnetation (880) fields present after filtering'); >+ >+ $schema->storage->txn_rollback(); >+}; >-- >2.20.1
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 15187
:
44850
|
44876
|
134457
|
137050
|
137207
|
137208
|
137233
| 137234