| Lines 17-23
          
      
      
        Link Here | 
        
          | 17 |  | 17 |  | 
        
          | 18 | use Modern::Perl; | 18 | use Modern::Perl; | 
        
          | 19 |  | 19 |  | 
          
            
              | 20 | use Test::More tests => 35; | 20 | use Test::More tests => 37; | 
        
          | 21 |  | 21 |  | 
        
          | 22 | my $destructorcount = 0; | 22 | my $destructorcount = 0; | 
        
          | 23 |  | 23 |  | 
  
    | Lines 33-39
          SKIP: {
      
      
        Link Here | 
        
          | 33 |     $ENV{ MEMCACHED_NAMESPACE } = 'unit_tests'; | 33 |     $ENV{ MEMCACHED_NAMESPACE } = 'unit_tests'; | 
        
          | 34 |     my $cache = Koha::Cache->get_instance(); | 34 |     my $cache = Koha::Cache->get_instance(); | 
        
          | 35 |  | 35 |  | 
          
            
              | 36 |     skip "Cache not enabled", 31 | 36 |     skip "Cache not enabled", 33 | 
        
          | 37 |       unless ( $cache->is_cache_active() && defined $cache ); | 37 |       unless ( $cache->is_cache_active() && defined $cache ); | 
        
          | 38 |  | 38 |  | 
        
          | 39 |     # test fetching an item that isnt in the cache | 39 |     # test fetching an item that isnt in the cache | 
  
    | Lines 181-192
          SKIP: {
      
      
        Link Here | 
        
          | 181 |     $item_from_cache = $cache->get_from_cache('test_deep_copy_array'); | 181 |     $item_from_cache = $cache->get_from_cache('test_deep_copy_array'); | 
        
          | 182 |     @$item_from_cache = qw( another array ref ); | 182 |     @$item_from_cache = qw( another array ref ); | 
        
          | 183 |     is_deeply( $cache->get_from_cache('test_deep_copy_array'), [ qw ( an array ref ) ], 'An array will be deep copied'); | 183 |     is_deeply( $cache->get_from_cache('test_deep_copy_array'), [ qw ( an array ref ) ], 'An array will be deep copied'); | 
            
              |  |  | 184 |     $item_from_cache = $cache->get_from_cache('test_deep_copy_array', { unsafe => 1 }); | 
            
              | 185 |     @$item_from_cache = qw( another array ref ); | 
            
              | 186 |     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'); | 
        
          | 184 |     # Hash | 187 |     # Hash | 
        
          | 185 |     my %item = ( a => 'hashref' ); | 188 |     my %item = ( a => 'hashref' ); | 
        
          | 186 |     $cache->set_in_cache('test_deep_copy_hash', \%item); | 189 |     $cache->set_in_cache('test_deep_copy_hash', \%item); | 
        
          | 187 |     $item_from_cache = $cache->get_from_cache('test_deep_copy_hash'); | 190 |     $item_from_cache = $cache->get_from_cache('test_deep_copy_hash'); | 
        
          | 188 |     %$item_from_cache = ( another => 'hashref' ); | 191 |     %$item_from_cache = ( another => 'hashref' ); | 
        
          | 189 |     is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { a => 'hashref' }, 'A hash will be deep copied'); | 192 |     is_deeply( $cache->get_from_cache('test_deep_copy_hash'), { a => 'hashref' }, 'A hash will be deep copied'); | 
            
              |  |  | 193 |     $item_from_cache = $cache->get_from_cache('test_deep_copy_hash', { unsafe => 1}); | 
            
              | 194 |     %$item_from_cache = ( another => 'hashref' ); | 
            
              | 195 |     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'); | 
        
          | 190 | } | 196 | } | 
        
          | 191 |  | 197 |  | 
        
          | 192 | END { | 198 | END { | 
            
              | 193 | -  |  |  |