PerlActor/Command/RunDir.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 42 CC 3 SCAR 12.8
CC
3
Cov
0%
execute
6.0
processFile
6.0
findAndExecuteScriptsIn
2.0
CRAP 3.6
1 package PerlActor::Command::RunDir;
2 use strict;
3  
4 use base 'PerlActor::Command';
5  
6 use PerlActor::Exception;
7 use File::Find;
8  
9 #===============================================================================================
10 # Public Methods
11 #===============================================================================================
12  
13 sub execute
14 {
15 my $self = shift;
16 my $dir = $self->getParam(0);
17
18 throw PerlActor::Exception("cannot collect test scripts: directory '$dir' does not exist!")
19 unless -e $dir;
20
21 $self->findAndExecuteScriptsIn($dir);
22 }
23  
24 sub findAndExecuteScriptsIn
25 {
26 my ($self, $dir) = @_;
27 find({ wanted => sub {$self->processFile()}, follow => 1, no_chdir => 1 }, $dir);
28 }
29  
30 sub processFile
31 {
32 my $self = shift;
33 my $file = $File::Find::name;
34 return unless $self->fileIsAPerlActorTest($file);
35 $self->executeScript($file);
36 }
37  
38 sub fileIsAPerlActorTest
39 {
40 my ($self, $file) = @_;
41 return $file =~ m/\.pact$/;
42 }
43  
44 #===============================================================================================
45 # Protected Methods - Don't even think about calling these from outside the class.
46 #===============================================================================================
47  
48 # Keep Perl happy.
49 1;