X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=t%2FCache.t;h=65cf52bc3744d11581709154370a927e48006f6d;hb=d9749756ca49dc5b6f65a3e1af877deae1161e2f;hp=5a5408579727466a352555c72d22545f90bddf15;hpb=b07f4debb73b01aa0a72a2b10506e171e79a8c05;p=koha_fer diff --git a/t/Cache.t b/t/Cache.t index 5a54085797..65cf52bc37 100644 --- a/t/Cache.t +++ b/t/Cache.t @@ -5,7 +5,7 @@ use strict; use warnings; -use Test::More tests => 29; +use Test::More tests => 32; my $destructorcount = 0; @@ -16,10 +16,10 @@ BEGIN { } SKIP: { - my $cache = Koha::Cache->new(); + my $cache = Koha::Cache->get_instance(); - skip "Cache not enabled", 13 - unless ( Koha::Cache->is_cache_active() && defined $cache ); + skip "Cache not enabled", 28 + unless ( $cache->is_cache_active() && defined $cache ); # test fetching an item that isnt in the cache is( $cache->get_from_cache("not in here"), @@ -134,12 +134,26 @@ SKIP: { $hash{'key'} = 'value'; is($myhash->{'key'}, 'value', 'retrieved value after clearing cache'); + + # UTF8 testing + my $utf8_str = "A Møøse once bit my sister"; + $cache->set_in_cache('utf8_1', $utf8_str); + is($cache->get_from_cache('utf8_1'), $utf8_str, 'Simple 8-bit UTF8 correctly retrieved'); + $utf8_str = "\x{20ac}"; # € + $cache->set_in_cache('utf8_1', $utf8_str); + my $utf8_res = $cache->get_from_cache('utf8_1'); + # This'll ensure that we're getting a unicode string back, rather than + # a couple of bytes. + is(length($utf8_res), 1, 'UTF8 string length correct'); + # ...and that it's really the character we intend + is(ord($utf8_res), 8364, 'UTF8 string value correct'); } END { SKIP: { + my $cache = Koha::Cache->get_instance(); skip "Cache not enabled", 1 - unless ( Koha::Cache->is_cache_active() ); + unless ( $cache->is_cache_active() ); is( $destructorcount, 1, 'Destructor run exactly once' ); } }