Bug 16412: Make sure Koha::Cache->set_in_cache will not warn anymore
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 2 May 2016 11:39:29 +0000 (12:39 +0100)
committerJesse Weaver <jweaver@bywatersolutions.com>
Thu, 12 May 2016 22:09:53 +0000 (16:09 -0600)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
t/Cache.t

index 5a5c248..101f723 100644 (file)
--- a/t/Cache.t
+++ b/t/Cache.t
@@ -17,7 +17,8 @@
 
 use Modern::Perl;
 
-use Test::More tests => 40;
+use Test::More tests => 41;
+use Test::Warn;
 
 my $destructorcount = 0;
 
@@ -40,6 +41,16 @@ SKIP: {
     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;