Bugzilla – Attachment 140313 Details for
Bug 31351
Worker dies on reindex job when operator last name/first name/branch name contains non-ASCII chars
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31351: (QA follow-up) Extend the encode/decode test
Bug-31351-QA-follow-up-Extend-the-encodedecode-tes.patch (text/plain), 2.83 KB, created by
Marcel de Rooy
on 2022-09-07 14:34:27 UTC
(
hide
)
Description:
Bug 31351: (QA follow-up) Extend the encode/decode test
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-09-07 14:34:27 UTC
Size:
2.83 KB
patch
obsolete
>From 217d037f73bad97f5c94fa2020b9e9739cf53f90 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 7 Sep 2022 13:51:07 +0000 >Subject: [PATCH] Bug 31351: (QA follow-up) Extend the encode/decode test >Content-Type: text/plain; charset=utf-8 > >Adding some Unicode stuff. >And missing txn couple. > >Test plan: >Run t/db_dependent/Koha/BackgroundJob.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Koha/BackgroundJob.t | 36 +++++++++++++++++++++++++---- > 1 file changed, 32 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/Koha/BackgroundJob.t b/t/db_dependent/Koha/BackgroundJob.t >index 848dbd50b7..f0f57163b1 100755 >--- a/t/db_dependent/Koha/BackgroundJob.t >+++ b/t/db_dependent/Koha/BackgroundJob.t >@@ -16,6 +16,8 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >+use utf8; >+use Encode; > > use Test::More tests => 5; > use Test::MockModule; >@@ -242,15 +244,41 @@ subtest 'process tests' => sub { > > subtest 'decoded_data() and set_encoded_data() tests' => sub { > >- plan tests => 3; >+ plan tests => 8; >+ $schema->storage->txn_begin; > > my $job = Koha::BackgroundJob::BatchUpdateItem->new->set_encoded_data( undef ); >- is( $job->decoded_data, undef ); >+ is( $job->decoded_data, undef, 'undef is undef' ); > > my $data = { some => 'data' }; > > $job->set_encoded_data( $data ); > >- is_deeply( $job->json->decode($job->data), $data ); >- is_deeply( $job->decoded_data, $data ); >+ is_deeply( $job->json->decode($job->data), $data, 'decode what we sent' ); >+ is_deeply( $job->decoded_data, $data, 'check with decoded_data' ); >+ >+ # Let's get some Unicode stuff into the game >+ $data = { favorite_Chinese => [ 'è', 'ç±' ], latin_dancing => [ '¢', 'Â¥', 'á', 'û' ] }; >+ $job->set_encoded_data( $data )->store; >+ >+ $job->discard_changes; # refresh >+ is_deeply( $job->decoded_data, $data, 'Deep compare with Unicode data' ); >+ # To convince you even more >+ is( ord( $job->decoded_data->{favorite_Chinese}->[0] ), 33873, 'We still found Unicode \x8451' ); >+ is( ord( $job->decoded_data->{latin_dancing}->[0] ), 162, 'We still found the equivalent of Unicode \x00A2' ); >+ >+ # Testing with sending encoded data (which we normally shouldnt do) >+ my $utf8_data; >+ foreach my $k ( 'favorite_Chinese', 'latin_dancing' ) { >+ foreach my $c ( @{$data->{$k}} ) { >+ push @{$utf8_data->{$k}}, Encode::encode('UTF-8', $c); >+ } >+ } >+ $job->set_encoded_data( $utf8_data )->store; >+ $job->discard_changes; # refresh >+ is_deeply( $job->decoded_data, $utf8_data, 'Deep compare with utf8_data' ); >+ # Need more evidence? >+ is( ord( $job->decoded_data->{favorite_Chinese}->[0] ), 232, 'We still found a UTF8 encoded byte' ); # ord does not need substr here >+ >+ $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 31351
:
139058
|
139438
|
140222
|
140236
|
140262
|
140310
|
140311
|
140312
|
140313
|
140314
|
140315