| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CHI::Driver::HandlerSocket::t::CHIDriverTests::Base; |
|
2
|
1
|
|
|
1
|
|
2849
|
use DBI; |
|
|
1
|
|
|
|
|
22130
|
|
|
|
1
|
|
|
|
|
247
|
|
|
3
|
1
|
|
|
1
|
|
2019
|
use Module::Load::Conditional qw(can_load); |
|
|
1
|
|
|
|
|
38506
|
|
|
|
1
|
|
|
|
|
74
|
|
|
4
|
1
|
|
|
1
|
|
1296
|
use Test::More; |
|
|
1
|
|
|
|
|
20976
|
|
|
|
1
|
|
|
|
|
15
|
|
|
5
|
1
|
|
|
1
|
|
386
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
37
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
35
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use base qw(CHI::t::Driver); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
2414
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub supports_get_namespaces { 0 } |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub SKIP_CLASS { |
|
12
|
|
|
|
|
|
|
my $class = shift; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
if ( not $class->dbh() ) { |
|
15
|
|
|
|
|
|
|
return "Unable to get a database connection"; |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
return 0; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub dbh { |
|
22
|
|
|
|
|
|
|
my $self = shift; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
eval { |
|
25
|
|
|
|
|
|
|
return DBI->connect( |
|
26
|
|
|
|
|
|
|
$self->dsn(), |
|
27
|
|
|
|
|
|
|
'', '', |
|
28
|
|
|
|
|
|
|
{ |
|
29
|
|
|
|
|
|
|
RaiseError => 0, |
|
30
|
|
|
|
|
|
|
PrintError => 0, |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
); |
|
33
|
|
|
|
|
|
|
}; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub new_cache_options { |
|
37
|
|
|
|
|
|
|
my $self = shift; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
return ( |
|
40
|
|
|
|
|
|
|
$self->SUPER::new_cache_options(), |
|
41
|
|
|
|
|
|
|
dbh => $self->dbh, |
|
42
|
|
|
|
|
|
|
create_table => 1 |
|
43
|
|
|
|
|
|
|
); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub test_with_dbix_connector : Tests(1) { |
|
47
|
|
|
|
|
|
|
return 'DBIx::Connector not installed' |
|
48
|
|
|
|
|
|
|
unless can_load( modules => { 'DBIx::Connector' => undef } ); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $self = shift; |
|
51
|
|
|
|
|
|
|
my $conn = DBIx::Connector->new( $self->dsn() ); |
|
52
|
|
|
|
|
|
|
my $cache = CHI->new( driver => 'DBI', dbh => $conn ); |
|
53
|
|
|
|
|
|
|
$cache->clear(); |
|
54
|
|
|
|
|
|
|
my $t = time; |
|
55
|
|
|
|
|
|
|
$cache->set( 'foo', $t ); |
|
56
|
|
|
|
|
|
|
is( $cache->get('foo'), $t ); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub test_with_dbi_generator : Tests(1) { |
|
60
|
|
|
|
|
|
|
my $self = shift; |
|
61
|
|
|
|
|
|
|
my $dbh = $self->dbh; |
|
62
|
|
|
|
|
|
|
my $cache = CHI->new( driver => 'DBI', dbh => sub { $dbh } ); |
|
63
|
|
|
|
|
|
|
$cache->clear(); |
|
64
|
|
|
|
|
|
|
my $t = time; |
|
65
|
|
|
|
|
|
|
$cache->set( 'foo', $t ); |
|
66
|
|
|
|
|
|
|
is( $cache->get('foo'), $t ); |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |