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