lib/Daje/Workflow/Checks.pm untested

filter: Statementstmt 0.0% 0 / 41 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 55 CC 5 SCAR 28.7
CC
5
Cov
0%
check
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 17.6
1 package Daje::Workflow::Checks;
2 use Mojo::Base -base, -signatures;
3 use v5.42;
4  
5 use Mojo::Loader qw(load_class);
6  
7 # Daje::Workflow::Checks - is an inteface class to pre and post checks
8 #
9 # METHODS
10 # =======
11 #
12 # check($self, $context, $checks)
13 #
14 # $checks = [
15 # {
16 # "name":"Mandatory fields",
17 # "class": "Daje::Workflow::Checks::Mandatory",
18 # "checks": "sql_path,perl_path"
19 # }
20 # ]
21 #
22 #
23  
24 use Data::Dumper;
25  
26 has 'db';
27 has 'error';
28 has 'model';
29  
30 sub check($self, $context, $checks) {
31 return 1 unless defined $checks;
32 my $result = 1;
33  
34 my $length = scalar @{$checks};
35 for (my $i = 0; $i < $length; $i++) {
36 if (length(@{$checks}[$i]->{class})) {
37 $self->model->insert_history(@{$checks}[$i]->{class}, 1);
38 if (my $e = load_class @{$checks}[$i]->{class}) {
39 $self->error->add_error($e)
40 }
41 if ($self->error->has_error() == 0) {
42 # $class->import();
43 $result = @{$checks}[$i]->{class}->new(
44 context => $context,
45 checks => @{$checks}[$i]->{checks},
46 error => $self->error,
47 model => $self->model,
48 db => $self->db,
49 )->check();
50 }
51 }
52 }
53 return $result;
54 }
55 1;
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69 #################### pod generated by Pod::Autopod - keep this line to make pod updates possible ####################
70  
71 =head1 NAME
72  
73 Daje::Workflow::Checks
74  
75  
76 =head1 DESCRIPTION
77  
78 Daje::Workflow::Checks - is an inteface class to pre and post checks
79  
80  
81  
82 =head1 REQUIRES
83  
84 L<Mojo::Loader>
85  
86 L<v5.42>
87  
88 L<Mojo::Base>
89  
90  
91 =head1 METHODS
92  
93  
94 check($self, $context, $checks)
95  
96 $checks = [
97 {
98 "name":"Mandatory fields",
99 "class": "Daje::Workflow::Checks::Mandatory",
100 "checks": "sql_path,perl_path"
101 }
102 ]
103  
104  
105  
106  
107 =cut
108