Bugzilla – Attachment 89362 Details for
Bug 22571
MARC modification templates do not handle control fields in conditional
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22571: Add tests
Bug-22571-Add-tests.patch (text/plain), 2.44 KB, created by
Jonathan Druart
on 2019-05-05 17:46:31 UTC
(
hide
)
Description:
Bug 22571: Add tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-05-05 17:46:31 UTC
Size:
2.44 KB
patch
obsolete
>From 4e1eb97b533266f1028e1fce0bb3a8843009bd57 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sun, 5 May 2019 12:41:43 -0500 >Subject: [PATCH] Bug 22571: Add tests > >--- > t/SimpleMARC.t | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 48 insertions(+), 1 deletion(-) > >diff --git a/t/SimpleMARC.t b/t/SimpleMARC.t >index 5958508dcb..4812e315f8 100644 >--- a/t/SimpleMARC.t >+++ b/t/SimpleMARC.t >@@ -1,6 +1,6 @@ > use Modern::Perl; > >-use Test::More tests => 10; >+use Test::More tests => 11; > > use_ok("MARC::Field"); > use_ok("MARC::Record"); >@@ -11,6 +11,9 @@ sub new_record { > $record->leader('03174nam a2200445 a 4500'); > my @fields = ( > MARC::Field->new( >+ '008', '120829t20132012nyu bk 001 0ceng', >+ ), >+ MARC::Field->new( > 100, '1', ' ', > a => 'Knuth, Donald Ervin', > d => '1938', >@@ -1693,3 +1696,47 @@ subtest 'delete_field' => sub { > is_deeply( \@fields_952, [], 'Delete all 952, 2 deleted' ); > }; > }; >+ >+subtest 'field_equals' => sub { >+ plan tests => 2; >+ my $record = new_record; >+ subtest 'standard MARC fields' => sub { >+ plan tests => 2; >+ my $match = Koha::SimpleMARC::field_equals({ >+ record => $record, >+ value => 'Donald', >+ field => '100', >+ subfield => 'a', >+ }); >+ is_deeply( $match, [], '100$a not equal to "Donald"' ); >+ >+ $match = Koha::SimpleMARC::field_equals({ >+ record => $record, >+ value => 'Donald', >+ field => '100', >+ subfield => 'a', >+ is_regex => 1, >+ }); >+ is_deeply( $match, [1], 'first 100$a matches "Donald"'); >+ }; >+ >+ subtest 'control fields' => sub { >+ plan tests => 2; >+ my $match = Koha::SimpleMARC::field_equals({ >+ record => $record, >+ value => 'eng', >+ field => '008', >+ subfield => '', >+ }); >+ is_deeply( $match, [], '008 control field not equal to "Donald"' ); >+ >+ $match = Koha::SimpleMARC::field_equals({ >+ record => $record, >+ value => 'eng', >+ field => '008', >+ subfield => '', >+ is_regex => 1, >+ }); >+ is_deeply( $match, [1], 'first 008 control field matches "Donald"' ); >+ }; >+}; >-- >2.11.0
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 22571
:
89362
|
89363
|
90683
|
90684
|
90685
|
90896
|
90897
|
90898