line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CHI::Driver::Redis::t::CHIDriverTests; |
2
|
1
|
|
|
1
|
|
652
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
3
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
9853
|
use CHI::Test; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use base qw(CHI::t::Driver); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Test::Mock::Redis; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub testing_driver_class { 'CHI::Driver::Redis' } |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub supports_expires_on_backend { 1 } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new_cache_options { |
15
|
|
|
|
|
|
|
my $self = shift; |
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
|
|
|
|
|
|
|
($ENV{CHI_REDIS_PASSWORD} ? ( password => $ENV{CHI_REDIS_PASSWORD} ) : ()), |
23
|
|
|
|
|
|
|
prefix => 'test' . $$ . ':', |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub clear_redis : Test(setup) { |
28
|
|
|
|
|
|
|
my ($self) = @_; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $cache = $self->new_cache; |
31
|
|
|
|
|
|
|
$cache->redis->flushall; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub test_redis_object : Tests(1) { |
35
|
|
|
|
|
|
|
my $self = shift; |
36
|
|
|
|
|
|
|
my $cache = $self->new_cache(redis => Test::Mock::Redis->new()); |
37
|
|
|
|
|
|
|
$cache->clear(); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub test_redis_options : Tests(1) { |
41
|
|
|
|
|
|
|
my $self = shift; |
42
|
|
|
|
|
|
|
my $cache = $self->new_cache(redis_options => { reconnect => 2 }); |
43
|
|
|
|
|
|
|
$cache->clear(); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub test_extra_options : Tests(1) { |
47
|
|
|
|
|
|
|
my $self = shift; |
48
|
|
|
|
|
|
|
my $cache = $self->new_cache(reconnect => 2); |
49
|
|
|
|
|
|
|
$cache->clear(); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |