Lines 17-29
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 40; |
20 |
use Test::More tests => 42; |
21 |
|
21 |
|
22 |
my $destructorcount = 0; |
22 |
my $destructorcount = 0; |
23 |
|
23 |
|
24 |
BEGIN { |
24 |
BEGIN { |
25 |
use_ok('Koha::Cache'); |
25 |
use_ok('Koha::Cache'); |
26 |
use_ok('Koha::Cache::Object'); |
26 |
use_ok('Koha::Cache::Object'); |
|
|
27 |
use_ok('Koha::Cache::Memory::Lite'); |
27 |
use_ok('C4::Context'); |
28 |
use_ok('C4::Context'); |
28 |
} |
29 |
} |
29 |
|
30 |
|
Lines 210-215
SKIP: {
Link Here
|
210 |
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'); |
211 |
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'); |
211 |
} |
212 |
} |
212 |
|
213 |
|
|
|
214 |
subtest 'Koha::Cache::Memory::Lite' => sub { |
215 |
plan tests => 6; |
216 |
my $memory_cache = Koha::Cache::Memory::Lite->get_instance(); |
217 |
|
218 |
# test fetching an item that isnt in the cache |
219 |
is( $memory_cache->get_from_cache("not in here"), |
220 |
undef, "fetching item NOT in cache" ); |
221 |
|
222 |
# test fetching a valid item from cache |
223 |
$memory_cache->set_in_cache( "clear_me", "I AM MORE DATA" ); |
224 |
$memory_cache->set_in_cache( "dont_clear_me", "I AM MORE DATA22" ); |
225 |
; # overly large expiry time, clear below |
226 |
is( |
227 |
$memory_cache->get_from_cache("clear_me"), |
228 |
"I AM MORE DATA", |
229 |
"fetching valid item from cache" |
230 |
); |
231 |
|
232 |
# test clearing from cache |
233 |
$memory_cache->clear_from_cache("clear_me"); |
234 |
is( $memory_cache->get_from_cache("clear_me"), |
235 |
undef, "fetching cleared item from cache" ); |
236 |
is( |
237 |
$memory_cache->get_from_cache("dont_clear_me"), |
238 |
"I AM MORE DATA22", |
239 |
"fetching valid item from cache (after clearing another item)" |
240 |
); |
241 |
|
242 |
#test flushing from cache |
243 |
$memory_cache->set_in_cache( "flush_me", "testing 1 data" ); |
244 |
$memory_cache->flush; |
245 |
is( $memory_cache->get_from_cache("flush_me"), |
246 |
undef, "fetching flushed item from cache" ); |
247 |
is( $memory_cache->get_from_cache("dont_clear_me"), |
248 |
undef, "fetching flushed item from cache" ); |
249 |
}; |
250 |
|
213 |
END { |
251 |
END { |
214 |
SKIP: { |
252 |
SKIP: { |
215 |
$ENV{ MEMCACHED_NAMESPACE } = 'unit_tests'; |
253 |
$ENV{ MEMCACHED_NAMESPACE } = 'unit_tests'; |
216 |
- |
|
|