Bug 16166: Fix t/Cache.t tests
Thou shalt not forget to include changes made in the t/Cache.t in the patch set. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
This commit is contained in:
parent
2b39cc7fff
commit
62f4e6bed2
1 changed files with 6 additions and 9 deletions
15
t/Cache.t
15
t/Cache.t
|
@ -17,7 +17,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 43;
|
||||
use Test::More tests => 42;
|
||||
use Test::Warn;
|
||||
|
||||
my $destructorcount = 0;
|
||||
|
@ -35,7 +35,7 @@ SKIP: {
|
|||
$ENV{ MEMCACHED_NAMESPACE } = 'unit_tests';
|
||||
my $cache = Koha::Cache->get_instance();
|
||||
|
||||
skip "Cache not enabled", 37
|
||||
skip "Cache not enabled", 36
|
||||
unless ( $cache->is_cache_active() && defined $cache );
|
||||
|
||||
# test fetching an item that isnt in the cache
|
||||
|
@ -201,7 +201,7 @@ SKIP: {
|
|||
|
||||
$item_from_cache = $cache->get_from_cache('test_deep_copy_array', { unsafe => 1 });
|
||||
@$item_from_cache = qw( another array ref );
|
||||
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');
|
||||
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');
|
||||
# Hash
|
||||
my %item = ( a => 'hashref' );
|
||||
$cache->set_in_cache('test_deep_copy_hash', \%item);
|
||||
|
@ -213,13 +213,10 @@ SKIP: {
|
|||
is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { a => 'hashref' }, 'A hash will be deep copied when set in cache');
|
||||
|
||||
%item = ( a => 'hashref' );
|
||||
$cache->set_in_cache('test_deep_copy_hash', \%item, { unsafe => 1});
|
||||
%item = ( a_modified => 'hashref' );
|
||||
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');
|
||||
|
||||
$item_from_cache = $cache->get_from_cache('test_deep_copy_hash', { unsafe => 1});
|
||||
$cache->set_in_cache('test_deep_copy_hash', \%item);
|
||||
$item_from_cache = $cache->get_from_cache('test_deep_copy_hash', { unsafe => 1 });
|
||||
%$item_from_cache = ( another => 'hashref' );
|
||||
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');
|
||||
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');
|
||||
}
|
||||
|
||||
subtest 'Koha::Cache::Memory::Lite' => sub {
|
||||
|
|
Loading…
Reference in a new issue