Bugzilla – Attachment 143794 Details for
Bug 24606
Allow storing item values as a template for creating new items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24606: Regression tests
Bug-24606-Regression-tests.patch (text/plain), 1.89 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-11-11 18:43:02 UTC
(
hide
)
Description:
Bug 24606: Regression tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-11-11 18:43:02 UTC
Size:
1.89 KB
patch
obsolete
>From 1d65a71cf617459eb24d3d024987a73e58180db7 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 11 Nov 2022 15:14:52 -0300 >Subject: [PATCH] Bug 24606: Regression tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Item/Template.t | 31 +++++++++++++++++++++++------ > 1 file changed, 25 insertions(+), 6 deletions(-) > >diff --git a/t/db_dependent/Koha/Item/Template.t b/t/db_dependent/Koha/Item/Template.t >index 20eb6269b90..6acb5c6ad0a 100755 >--- a/t/db_dependent/Koha/Item/Template.t >+++ b/t/db_dependent/Koha/Item/Template.t >@@ -19,6 +19,9 @@ > > use Modern::Perl; > >+use Encode; >+use JSON; >+ > use Koha::Database; > > use t::lib::TestBuilder; >@@ -31,18 +34,34 @@ my $builder = t::lib::TestBuilder->new; > use_ok("Koha::Item::Template"); > > subtest 'Serializing and deserializing contents' => sub { >+ > plan tests => 2; > > $schema->storage->txn_begin; > >- my $data = { location => 'test' }; >- my $template = Koha::Item::Template->new({ >- name => 'My template', >+ my $data = { >+ location => 'test', >+ cost => "2\x{20ac}", >+ }; >+ >+ my $template = Koha::Item::Template->new( >+ { name => 'My template', > contents => $data, >- })->store(); >+ } >+ )->store(); >+ >+ my $encoded_data; >+ foreach my $key ( keys %{$data} ) { >+ $encoded_data->{$key} = Encode::encode('UTF-8', $data->{$key}); >+ } >+ >+ is( $template->contents, JSON->new->utf8->encode($data), 'Contents serialized correctly' ); > >- is( $template->contents, '{"location":"test"}', 'Contents serialized correctly' ); >- is( $template->decoded_contents->{location}, 'test', 'Contents deserialized correctly' ); >+ is_deeply( >+ $template->decoded_contents, >+ $encoded_data, >+ 'Contents deserialized and UTF-8 encoded correctly' >+ ); > > $schema->storage->txn_rollback; > }; >-- >2.38.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 24606
:
141613
|
141614
|
141615
|
141616
|
141617
|
141717
|
141718
|
141719
|
141720
|
141721
|
141972
|
142003
|
142004
|
142005
|
142006
|
142007
|
142008
|
142833
|
142834
|
142835
|
142836
|
142837
|
142877
|
142878
|
142879
|
142880
|
142881
|
142882
|
142883
|
142884
|
142885
|
142886
|
142887
|
142888
|
143020
|
143569
|
143570
|
143571
|
143572
|
143573
|
143574
|
143575
|
143576
|
143577
|
143578
|
143579
|
143580
|
143581
| 143794 |
143795
|
143796
|
143989
|
143990
|
144161