Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 32; |
20 |
use Test::More tests => 35; |
21 |
|
21 |
|
22 |
my $destructorcount = 0; |
22 |
my $destructorcount = 0; |
23 |
|
23 |
|
Lines 33-39
SKIP: {
Link Here
|
33 |
$ENV{ MEMCACHED_NAMESPACE } = 'unit_tests'; |
33 |
$ENV{ MEMCACHED_NAMESPACE } = 'unit_tests'; |
34 |
my $cache = Koha::Cache->get_instance(); |
34 |
my $cache = Koha::Cache->get_instance(); |
35 |
|
35 |
|
36 |
skip "Cache not enabled", 28 |
36 |
skip "Cache not enabled", 31 |
37 |
unless ( $cache->is_cache_active() && defined $cache ); |
37 |
unless ( $cache->is_cache_active() && defined $cache ); |
38 |
|
38 |
|
39 |
# test fetching an item that isnt in the cache |
39 |
# test fetching an item that isnt in the cache |
Lines 167-172
SKIP: {
Link Here
|
167 |
is(length($utf8_res), 1, 'UTF8 string length correct'); |
167 |
is(length($utf8_res), 1, 'UTF8 string length correct'); |
168 |
# ...and that it's really the character we intend |
168 |
# ...and that it's really the character we intend |
169 |
is(ord($utf8_res), 8364, 'UTF8 string value correct'); |
169 |
is(ord($utf8_res), 8364, 'UTF8 string value correct'); |
|
|
170 |
|
171 |
# Make sure the item will be deep copied |
172 |
# Scalar |
173 |
my $item = "just a simple scalar"; |
174 |
$cache->set_in_cache('test_deep_copy', $item); |
175 |
my $item_from_cache = $cache->get_from_cache('test_deep_copy'); |
176 |
$item_from_cache = "a modified scalar"; |
177 |
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' ); |
178 |
# Array |
179 |
my @item = qw( an array ref ); |
180 |
$cache->set_in_cache('test_deep_copy_array', \@item); |
181 |
$item_from_cache = $cache->get_from_cache('test_deep_copy_array'); |
182 |
@$item_from_cache = qw( another array ref ); |
183 |
is_deeply( $cache->get_from_cache('test_deep_copy_array'), [ qw ( an array ref ) ], 'An array will be deep copied'); |
184 |
# Hash |
185 |
my %item = ( a => 'hashref' ); |
186 |
$cache->set_in_cache('test_deep_copy_hash', \%item); |
187 |
$item_from_cache = $cache->get_from_cache('test_deep_copy_hash'); |
188 |
%$item_from_cache = ( another => 'hashref' ); |
189 |
is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { a => 'hashref' }, 'A hash will be deep copied'); |
170 |
} |
190 |
} |
171 |
|
191 |
|
172 |
END { |
192 |
END { |
173 |
- |
|
|