Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 43; |
20 |
use Test::More tests => 42; |
21 |
use Test::Warn; |
21 |
use Test::Warn; |
22 |
|
22 |
|
23 |
my $destructorcount = 0; |
23 |
my $destructorcount = 0; |
Lines 35-41
SKIP: {
Link Here
|
35 |
$ENV{ MEMCACHED_NAMESPACE } = 'unit_tests'; |
35 |
$ENV{ MEMCACHED_NAMESPACE } = 'unit_tests'; |
36 |
my $cache = Koha::Cache->get_instance(); |
36 |
my $cache = Koha::Cache->get_instance(); |
37 |
|
37 |
|
38 |
skip "Cache not enabled", 37 |
38 |
skip "Cache not enabled", 36 |
39 |
unless ( $cache->is_cache_active() && defined $cache ); |
39 |
unless ( $cache->is_cache_active() && defined $cache ); |
40 |
|
40 |
|
41 |
# test fetching an item that isnt in the cache |
41 |
# test fetching an item that isnt in the cache |
Lines 201-207
SKIP: {
Link Here
|
201 |
|
201 |
|
202 |
$item_from_cache = $cache->get_from_cache('test_deep_copy_array', { unsafe => 1 }); |
202 |
$item_from_cache = $cache->get_from_cache('test_deep_copy_array', { unsafe => 1 }); |
203 |
@$item_from_cache = qw( another array ref ); |
203 |
@$item_from_cache = qw( another array ref ); |
204 |
is_deeply( $cache->get_from_cache('test_deep_copy_array'), [ qw ( another array ref ) ], 'An array will not be deep copied if the unsafe flag is set'); |
204 |
is_deeply( $cache->get_from_cache('test_deep_copy_array', { unsafe => 1 }), [ qw ( another array ref ) ], 'An array will not be deep copied if the unsafe flag is set'); |
205 |
# Hash |
205 |
# Hash |
206 |
my %item = ( a => 'hashref' ); |
206 |
my %item = ( a => 'hashref' ); |
207 |
$cache->set_in_cache('test_deep_copy_hash', \%item); |
207 |
$cache->set_in_cache('test_deep_copy_hash', \%item); |
Lines 213-225
SKIP: {
Link Here
|
213 |
is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { a => 'hashref' }, 'A hash will be deep copied when set in cache'); |
213 |
is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { a => 'hashref' }, 'A hash will be deep copied when set in cache'); |
214 |
|
214 |
|
215 |
%item = ( a => 'hashref' ); |
215 |
%item = ( a => 'hashref' ); |
216 |
$cache->set_in_cache('test_deep_copy_hash', \%item, { unsafe => 1}); |
216 |
$cache->set_in_cache('test_deep_copy_hash', \%item); |
217 |
%item = ( a_modified => 'hashref' ); |
217 |
$item_from_cache = $cache->get_from_cache('test_deep_copy_hash', { unsafe => 1 }); |
218 |
is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { a_modified => 'hashref' }, 'A hash will not be deep copied when set in cache if the unsafe flag is set'); |
|
|
219 |
|
220 |
$item_from_cache = $cache->get_from_cache('test_deep_copy_hash', { unsafe => 1}); |
221 |
%$item_from_cache = ( another => 'hashref' ); |
218 |
%$item_from_cache = ( another => 'hashref' ); |
222 |
is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { another => 'hashref' }, 'A hash will not be deep copied if the unsafe flag is set'); |
219 |
is_deeply( $cache->get_from_cache('test_deep_copy_hash', { unsafe => 1 }), { another => 'hashref' }, 'A hash will not be deep copied if the unsafe flag is set'); |
223 |
} |
220 |
} |
224 |
|
221 |
|
225 |
subtest 'Koha::Cache::Memory::Lite' => sub { |
222 |
subtest 'Koha::Cache::Memory::Lite' => sub { |
226 |
- |
|
|