From 337e8874600f757fe197062fd2967d27316b8cd1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 2 May 2016 12:39:29 +0100 Subject: [PATCH] Bug 16412: Make sure Koha::Cache->set_in_cache will not warn anymore Signed-off-by: Jonathan Druart Signed-off-by: Katrin Fischer Signed-off-by: Jesse Weaver (cherry picked from commit 53e410b14e2a3942bb577eff81c55799343d10d1) Signed-off-by: Julian Maurice --- t/Cache.t | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/t/Cache.t b/t/Cache.t index 42ee62c366..b2ea1de897 100644 --- a/t/Cache.t +++ b/t/Cache.t @@ -17,7 +17,8 @@ use Modern::Perl; -use Test::More tests => 42; +use Test::More tests => 43; +use Test::Warn; my $destructorcount = 0; @@ -34,13 +35,23 @@ SKIP: { $ENV{ MEMCACHED_NAMESPACE } = 'unit_tests'; my $cache = Koha::Cache->get_instance(); - skip "Cache not enabled", 36 + skip "Cache not enabled", 37 unless ( $cache->is_cache_active() && defined $cache ); # test fetching an item that isnt in the cache is( $cache->get_from_cache("not in here"), undef, "fetching item NOT in cache" ); + # set_in_cache should not warn + my $warn; + { + local $SIG{__WARN__} = sub { + $warn = shift; + }; + $cache->set_in_cache( "a key", undef ); + is( $warn, undef, 'Koha::Cache->set_in_cache should not return any warns' ); + } + # test expiry time in cache $cache->set_in_cache( "timeout", "I AM DATA", 1 ); # expiry time of 1 second sleep 2; -- 2.39.5