DBI/t/CHIDriverTests/Base.pm

filter: Statementstmt 60.3% 32 / 53 Branchbran 25.0% 1 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 58.8% 10 / 17 Podpod 12.5% 1 / 8 totaltotal 53.6% 44 / 82 CC 3 SCAR 6.5
CC
3
Cov
58%
test_with_dbix_connector
6.0
SKIP_CLASS
2.1
testing_driver_class
2.0
CRAP 1.9
« DBI.pm ↑ Summary DBI/t/CHIDriverTests/SQLite.pm »
1 package CHI::Driver::DBI::t::CHIDriverTests::Base;
2 2 $CHI::Driver::DBI::t::CHIDriverTests::Base::VERSION = '1.27';
3 2 ▶use DBI;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Module::Load::Conditional qw(can_load);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use base qw(CHI::t::Driver);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 0 ▶sub testing_driver_class { 'CHI::Driver::DBI' }
Subroutine testing_driver_class: not called CC=1 SCAR=6.9
Pod undocumented
11 0 ▶sub supports_get_namespaces { 0 }
Subroutine supports_get_namespaces: not called CC=1 SCAR=6.9
Pod undocumented
12  
13 2 ▶sub SKIP_CLASS {
Subroutine SKIP_CLASS: called CC=2 SCAR=7.6
Pod documented
14 2 my $class = shift;
15  
16 2 ▶ if ( not $class->dbh() ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($class->dbh) 2 0 2
17 2 return "Unable to get a database connection";
18 }
19  
20 0 return 0;
21 }
22  
23 2 ▶sub dbh {
Subroutine dbh: called CC=1 SCAR=0.0
Pod undocumented
24 2 my $self = shift;
25  
26 2 eval {
27 2 return DBI->connect(
28 $self->dsn(),
29 '', '',
30 {
31 RaiseError => 0,
32 PrintError => 0,
33 }
34 );
35 };
36 }
37  
38 0 ▶sub new_cache_options {
Subroutine new_cache_options: not called CC=1 SCAR=6.9
Pod undocumented
39 0 my $self = shift;
40  
41 return (
42 0 $self->SUPER::new_cache_options(),
43 dbh => $self->dbh,
44 create_table => 1
45 );
46 }
47  
48 0 ▶sub test_with_dbix_connector : Tests(1) {
Subroutine test_with_dbix_connector: not called CC=2 SCAR=17.9
Pod undocumented
49 0 ▶ return 'DBIx::Connector not installed'
Branch: 1 branch
BranchTrueFalseTotal
unless can_load("modules", {"DBIx::Connector", undef}) 0 0 0
50 unless can_load( modules => { 'DBIx::Connector' => undef } );
51  
52 0 my $self = shift;
53 0 my $conn = DBIx::Connector->new( $self->dsn() );
54 0 my $cache = CHI->new( driver => 'DBI', dbh => $conn );
55 0 $cache->clear();
56 0 my $t = time;
57 0 $cache->set( 'foo', $t );
58 0 is( $cache->get('foo'), $t );
59 2 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
60  
61 0 ▶sub test_with_dbi_generator : Tests(1) {
Subroutine test_with_dbi_generator: not called CC=1 SCAR=6.9
Pod undocumented
62 0 my $self = shift;
63 0 my $dbh = $self->dbh;
64 0 ▶ my $cache = CHI->new( driver => 'DBI', dbh => sub { $dbh } );
Subroutine __ANON__: not called CC=1 SCAR=6.9
65 0 $cache->clear();
66 0 my $t = time;
67 0 $cache->set( 'foo', $t );
68 0 is( $cache->get('foo'), $t );
69 2 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
70  
71 0 ▶sub test_multiple_processes { }
Subroutine test_multiple_processes: not called CC=1 SCAR=0.0
Pod undocumented
72  
73 2 1;
« DBI.pm ↑ Summary DBI/t/CHIDriverTests/SQLite.pm »