Memcached/Test/Driver.pm untested

filter: Statementstmt 0.0% 0 / 43 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 56 SCAR 6.9
CC
1
Cov
0%
all_test_keys
2.0
get_keys
2.0
clear
2.0
CRAP 2.0
1 package CHI::Driver::Memcached::Test::Driver;
2 $CHI::Driver::Memcached::Test::Driver::VERSION = '0.15';
3 use strict;
4 use warnings;
5 use Moose;
6 use CHI::t::Driver;
7 use CHI::Driver::Memcached::t::CHIDriverTests;
8 use base qw(CHI::Driver::Memcached);
9  
10 __PACKAGE__->meta->make_immutable;
11  
12 # Reverse declare_unsupported_methods
13 #
14 foreach my $method (qw(dump_as_hash is_empty purge)) {
15 no strict 'refs';
16 *{ __PACKAGE__ . "::$method" } = sub {
17 my $self = shift;
18 my $full_method = "CHI::Driver::$method";
19 return $self->$full_method(@_);
20 };
21 }
22  
23 sub all_test_keys {
24 my ($standard_keys) =
25 CHI::Driver::Memcached::t::CHIDriverTests->set_standard_keys_and_values();
26 my $all_test_keys = [
27 values(%$standard_keys),
28 CHI::Driver::Memcached::t::CHIDriverTests->extra_test_keys()
29 ];
30 return $all_test_keys;
31 }
32  
33 # Memcached doesn't support get_keys. For testing purposes, define get_keys
34 # and clear by checking for all keys used during testing. Note, some keys
35 # are changed in CHIDriverTests::set_standard_keys_and_values.
36 #
37 sub get_keys {
38 my $self = shift;
39  
40 my $all_test_keys = $self->all_test_keys;
41 my $values = $self->get_multi_hashref($all_test_keys);
42 my @defined_keys = grep { defined $values->{$_} } keys(%$values);
43 return @defined_keys;
44 }
45  
46 sub clear {
47 my $self = shift;
48  
49 my $all_test_keys = $self->all_test_keys;
50 foreach my $key (@$all_test_keys) {
51 $self->remove($key);
52 }
53 }
54  
55 1;