Memcached/Test/Driver/Base.pm untested

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