File Coverage

blib/lib/Test/DBChanges/Role/Base.pm
Criterion Covered Total %
statement 14 22 63.6
branch n/a
condition n/a
subroutine 5 7 71.4
pod n/a
total 19 29 65.5


line stmt bran cond sub pod time code
1             package Test::DBChanges::Role::Base;
2 2     2   891 use Moo::Role;
  2         5  
  2         10  
3 2     2   700 use 5.024;
  2         8  
4 2     2   11 use Types::Standard qw(ArrayRef Str);
  2         4  
  2         12  
5 2     2   1945 use Test::DBChanges::ChangeSet;
  2         7  
  2         67  
6 2     2   14 use namespace::autoclean;
  2         4  
  2         8  
7              
8             our $VERSION = '1.0.1'; # VERSION
9             # ABSTRACT: base role for all DBChanges classes
10              
11              
12             has source_names => ( is => 'ro', required => 1, isa => ArrayRef[Str] );
13              
14             has _table_source_map => (
15             is => 'lazy',
16             builder => sub {
17 0     0     my ($self) = @_;
18              
19             my %table_source_map = map {
20 0           my $source_name = $_;
  0            
21 0           my ($table_name, $factory) = $self->_table_and_factory_for_source($source_name);
22 0           ( $table_name => { name => $source_name, factory => $factory } );
23             } $self->source_names->@*;
24              
25 0           return \%table_source_map;
26             },
27             );
28              
29             requires qw(_table_and_factory_for_source changeset_for_code);
30              
31             sub _make_changeset {
32 0     0     my ($self,$raw_changes) = @_;
33              
34 0           return Test::DBChanges::ChangeSet->new({
35             table_source_map => $self->_table_source_map,
36             raw_changes => $raw_changes,
37             });
38             }
39              
40             1;
41              
42             __END__