View | Details | Raw Unified | Return to bug 16166
Collapse All | Expand All

(-)a/t/Cache.t (-10 / +6 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 41;
20
use Test::More tests => 39;
21
use Test::Warn;
21
use Test::Warn;
22
22
23
my $destructorcount = 0;
23
my $destructorcount = 0;
Lines 34-40 SKIP: { Link Here
34
    $ENV{ MEMCACHED_NAMESPACE } = 'unit_tests';
34
    $ENV{ MEMCACHED_NAMESPACE } = 'unit_tests';
35
    my $cache = Koha::Cache->get_instance();
35
    my $cache = Koha::Cache->get_instance();
36
36
37
    skip "Cache not enabled", 33
37
    skip "Cache not enabled", 35
38
      unless ( $cache->is_cache_active() && defined $cache );
38
      unless ( $cache->is_cache_active() && defined $cache );
39
39
40
    # test fetching an item that isnt in the cache
40
    # test fetching an item that isnt in the cache
Lines 200-206 SKIP: { Link Here
200
200
201
    $item_from_cache = $cache->get_from_cache('test_deep_copy_array', { unsafe => 1 });
201
    $item_from_cache = $cache->get_from_cache('test_deep_copy_array', { unsafe => 1 });
202
    @$item_from_cache = qw( another array ref );
202
    @$item_from_cache = qw( another array ref );
203
    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');
203
    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');
204
    # Hash
204
    # Hash
205
    my %item = ( a => 'hashref' );
205
    my %item = ( a => 'hashref' );
206
    $cache->set_in_cache('test_deep_copy_hash', \%item);
206
    $cache->set_in_cache('test_deep_copy_hash', \%item);
Lines 212-224 SKIP: { Link Here
212
    is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { a => 'hashref' }, 'A hash will be deep copied when set in cache');
212
    is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { a => 'hashref' }, 'A hash will be deep copied when set in cache');
213
213
214
    %item = ( a => 'hashref' );
214
    %item = ( a => 'hashref' );
215
    $cache->set_in_cache('test_deep_copy_hash', \%item, { unsafe => 1});
215
    $cache->set_in_cache('test_deep_copy_hash', \%item);
216
    %item = ( a_modified => 'hashref' );
216
    $item_from_cache = $cache->get_from_cache('test_deep_copy_hash', { unsafe => 1 });
217
    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');
218
219
    $item_from_cache = $cache->get_from_cache('test_deep_copy_hash', { unsafe => 1});
220
    %$item_from_cache = ( another => 'hashref' );
217
    %$item_from_cache = ( another => 'hashref' );
221
    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');
218
    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');
222
}
219
}
223
220
224
END {
221
END {
225
- 

Return to bug 16166