File Coverage

blib/lib/Test/SQL/DB.pm
Criterion Covered Total %
statement 26 29 89.6
branch 2 4 50.0
condition n/a
subroutine 8 8 100.0
pod n/a
total 36 41 87.8


line stmt bran cond sub pod time code
1             package Test::SQL::DB;
2 2     2   485309 use strict;
  2         4  
  2         73  
3 2     2   97 use warnings;
  2         4  
  2         76  
4 2     2   11 use File::ShareDir qw/dist_dir/;
  2         3  
  2         133  
5 2     2   10 use Log::Any qw/$log/;
  2         2  
  2         16  
6 2     2   117 use Moo::Role;
  2         6  
  2         20  
7 2     2   557 use Path::Class;
  2         3  
  2         108  
8 2     2   9 use SQL::DBx::Deploy;
  2         6  
  2         346  
9              
10             our $VERSION = '0.971.2';
11              
12             sub _clean_database {
13 3     3   1327 my $self = shift;
14              
15             # The lib ("prove -Ilib t/*") case:
16 3         29 my $dir1 =
17             file(__FILE__)
18             ->parent->parent->parent->parent->subdir( 'share', $self->dbd );
19              
20             # The blib ("make test") case
21 3         1766 my $dir2 =
22             file(__FILE__)
23             ->parent->parent->parent->parent->parent->subdir( 'share', $self->dbd );
24              
25 3 50       936 if ( -d $dir1 ) {
    50          
26 0         0 $self->run_dir( $dir1->subdir('clean') );
27             }
28             elsif ( -d $dir2 ) {
29 3         167 $self->run_dir( $dir2->subdir('clean') );
30             }
31             else {
32             # The "installed" case
33 0           my $distdir = dir( dist_dir('SQL-DB'), $self->dbd, 'clean' );
34 0           $self->run_dir($distdir);
35             }
36             }
37              
38             Moo::Role->apply_role_to_package( 'SQL::DB', __PACKAGE__ );
39              
40             1;