Bugzilla – Attachment 129528 Details for
Bug 29781
Allow item batch modification to use capturing groups in regex option
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29781: Unit test
Bug-29781-Unit-test.patch (text/plain), 2.09 KB, created by
Martin Renvoize (ashimema)
on 2022-01-17 13:53:23 UTC
(
hide
)
Description:
Bug 29781: Unit test
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-01-17 13:53:23 UTC
Size:
2.09 KB
patch
obsolete
>From a7dc745c7d72a87609cc8ff5d3637c316284161e Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 17 Jan 2022 13:50:34 +0000 >Subject: [PATCH] Bug 29781: Unit test > >This patch adds a unit test for capture groups support in Koha::Items > >Test plan >1) Run the test prior to applying the capture groups fix, note it fails. >2) Apply the capture groups fix patch >3) Run the test again, it should now pass >--- > t/db_dependent/Koha/Items/BatchUpdate.t | 37 ++++++++++++++++++++++++- > 1 file changed, 36 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Items/BatchUpdate.t b/t/db_dependent/Koha/Items/BatchUpdate.t >index b07d0bf7cf..a5c5c0fcba 100755 >--- a/t/db_dependent/Koha/Items/BatchUpdate.t >+++ b/t/db_dependent/Koha/Items/BatchUpdate.t >@@ -155,7 +155,7 @@ subtest 'blank' => sub { > }; > > subtest 'regex' => sub { >- plan tests => 6; >+ plan tests => 12; > > $items->batch_update( > { >@@ -203,6 +203,41 @@ subtest 'regex' => sub { > ['awesome yyy 1|new yyy 2'], > 'y is not repeatable' > ); >+ >+ $re = { >+ search => '(awesome)', >+ replace => '$1ness', >+ modifiers => '', >+ }; >+ $items->batch_update( >+ { >+ regex_mod => >+ { itemnotes => $re, copynumber => $re, x => $re, y => $re } >+ } >+ )->reset; >+ $item = $item->get_from_storage; >+ is( $item->itemnotes, 'awesomeness notes 1|new notes 2' ); >+ is_deeply( >+ [ $item->as_marc_field->subfield('z') ], >+ [ 'awesomeness notes 1', 'new notes 2' ], >+ 'z is repeatable' >+ ); >+ >+ is( $item->copynumber, 'awesomeness cn 1|new cn 2' ); >+ is_deeply( [ $item->as_marc_field->subfield('t') ], >+ ['awesomeness cn 1|new cn 2'], 't is not repeatable' ); >+ >+ is_deeply( >+ [ $item->as_marc_field->subfield('x') ], >+ [ 'awesomeness xxx 1', 'new xxx 2' ], >+ 'i is repeatable' >+ ); >+ >+ is_deeply( >+ [ $item->as_marc_field->subfield('y') ], >+ ['awesomeness yyy 1|new yyy 2'], >+ 'y is not repeatable' >+ ); > }; > > subtest 'encoding' => sub { >-- >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 29781
:
129526
|
129527
|
129528
|
129529
|
129573
|
129574
|
130498
|
130499
|
130508
|
130509