Bugzilla – Attachment 49547 Details for
Bug 16044
Define a L1 cache for all objects set in cache
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16044: Add tests to make sure structures will be copied
Bug-16044-Add-tests-to-make-sure-structures-will-b.patch (text/plain), 2.27 KB, created by
Tomás Cohen Arazi (tcohen)
on 2016-03-24 19:07:45 UTC
(
hide
)
Description:
Bug 16044: Add tests to make sure structures will be copied
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2016-03-24 19:07:45 UTC
Size:
2.27 KB
patch
obsolete
>From dbc8290e0ec172e090502b219d80d7564d694484 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 15 Mar 2016 15:50:15 +0000 >Subject: [PATCH] Bug 16044: Add tests to make sure structures will be copied > >Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/Cache.t | 24 ++++++++++++++++++++++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > >diff --git a/t/Cache.t b/t/Cache.t >index 0548a62..1780025 100644 >--- a/t/Cache.t >+++ b/t/Cache.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 32; >+use Test::More tests => 35; > > my $destructorcount = 0; > >@@ -33,7 +33,7 @@ SKIP: { > $ENV{ MEMCACHED_NAMESPACE } = 'unit_tests'; > my $cache = Koha::Cache->get_instance(); > >- skip "Cache not enabled", 28 >+ skip "Cache not enabled", 31 > unless ( $cache->is_cache_active() && defined $cache ); > > # test fetching an item that isnt in the cache >@@ -167,6 +167,26 @@ SKIP: { > is(length($utf8_res), 1, 'UTF8 string length correct'); > # ...and that it's really the character we intend > is(ord($utf8_res), 8364, 'UTF8 string value correct'); >+ >+ # Make sure the item will be deep copied >+ # Scalar >+ my $item = "just a simple scalar"; >+ $cache->set_in_cache('test_deep_copy', $item); >+ my $item_from_cache = $cache->get_from_cache('test_deep_copy'); >+ $item_from_cache = "a modified scalar"; >+ is( $cache->get_from_cache('test_deep_copy'), 'just a simple scalar', 'A scalar will not be modified in the cache if get from the cache' ); >+ # Array >+ my @item = qw( an array ref ); >+ $cache->set_in_cache('test_deep_copy_array', \@item); >+ $item_from_cache = $cache->get_from_cache('test_deep_copy_array'); >+ @$item_from_cache = qw( another array ref ); >+ is_deeply( $cache->get_from_cache('test_deep_copy_array'), [ qw ( an array ref ) ], 'An array will be deep copied'); >+ # Hash >+ my %item = ( a => 'hashref' ); >+ $cache->set_in_cache('test_deep_copy_hash', \%item); >+ $item_from_cache = $cache->get_from_cache('test_deep_copy_hash'); >+ %$item_from_cache = ( another => 'hashref' ); >+ is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { a => 'hashref' }, 'A hash will be deep copied'); > } > > END { >-- >2.7.4
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 16044
:
48968
|
49179
|
49186
|
49187
|
49188
|
49239
|
49240
|
49490
|
49491
|
49492
|
49493
|
49494
|
49545
|
49546
| 49547 |
49548
|
49549
|
49555
|
49568
|
49647