Bugzilla – Attachment 90683 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.49 KB, created by
Mark Tompsett
on 2019-06-17 17:59:31 UTC
(
hide
)
Description:
Bug 22571: Add tests
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2019-06-17 17:59:31 UTC
Size:
2.49 KB
patch
obsolete
>From c40c83b47b6d50a4567fc3b7881ba872f70432bb 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 > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > 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