Redis/t/CHIDriverTests.pm

filter: Statementstmt 100% 44 / 44 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 16 / 16 Podpod 0.0% 0 / 7 totaltotal 85.1% 63 / 74 SCAR 13.9
CC
4
Cov
94%
new_cache_options
4.8
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
« Redis.pm ↑ Summary
1 package CHI::Driver::Redis::t::CHIDriverTests;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use CHI::Test;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use base qw(CHI::t::Driver);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Test::Mock::Redis;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 148 ▶sub testing_driver_class { 'CHI::Driver::Redis' }
Subroutine testing_driver_class: called CC=1 SCAR=0.0
Pod undocumented
11  
12 1 ▶sub supports_expires_on_backend { 1 }
Subroutine supports_expires_on_backend: called CC=1 SCAR=0.0
Pod undocumented
13  
14 sub new_cache_options {
15 144 ▶ my $self = shift;
Subroutine new_cache_options: called CC=4 SCAR=15.8
Pod undocumented
16  
17 return (
18 $self->SUPER::new_cache_options(),
19 driver_class => 'CHI::Driver::Redis',
20 redis_class => (defined $ENV{CHI_REDIS_SERVER} ? 'Redis' : 'Test::Mock::Redis'),
21 server => $ENV{CHI_REDIS_SERVER} || undef,
22 144 ▶ ($ENV{CHI_REDIS_PASSWORD} ? ( password => $ENV{CHI_REDIS_PASSWORD} ) : ()),
Branch: 2 branches
BranchTrueFalseTotal
defined $ENV{'CHI_REDIS_SERVER'} ? : 0 144 144
$ENV{'CHI_REDIS_PASSWORD'} ? : 0 144 144
Condition50%1/2
$ENV{'CHI_REDIS_SERVER'} || undef
l!l
0144
MC/DC0%0/1
$ENV{'CHI_REDIS_SERVER'} || undef
$ENV{'CHI_REDIS_SERVER'}
Truth table50%1/2
A
A= $ENV{'CHI_REDIS_SERVER'}
Aresult
11
00
23 prefix => 'test' . $$ . ':',
24 );
25 }
26  
27 sub clear_redis : Test(setup) {
28 51 ▶ my ($self) = @_;
Subroutine clear_redis: called CC=1 SCAR=0.0
Pod undocumented
29  
30 51 my $cache = $self->new_cache;
31 51 $cache->redis->flushall;
32 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 sub test_redis_object : Tests(1) {
35 1 ▶ my $self = shift;
Subroutine test_redis_object: called CC=1 SCAR=0.0
Pod undocumented
36 1 my $cache = $self->new_cache(redis => Test::Mock::Redis->new());
37 1 $cache->clear();
38 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
39  
40 sub test_redis_options : Tests(1) {
41 1 ▶ my $self = shift;
Subroutine test_redis_options: called CC=1 SCAR=0.0
Pod undocumented
42 1 my $cache = $self->new_cache(redis_options => { reconnect => 2 });
43 1 $cache->clear();
44 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
45  
46 sub test_extra_options : Tests(1) {
47 1 ▶ my $self = shift;
Subroutine test_extra_options: called CC=1 SCAR=0.0
Pod undocumented
48 1 my $cache = $self->new_cache(reconnect => 2);
49 1 $cache->clear();
50 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
51  
52 1 1;
« Redis.pm ↑ Summary