lib/Rex/Test/Base/has_cron_env.pm

filter: Statementstmt 44.4% 16 / 36 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 62.5% 5 / 8 Podpod 33.3% 1 / 3 totaltotal 33.3% 22 / 66 CC 6 SCAR 19.2
CC
6
Cov
33%
run_test
12.0
run_not_test
12.0
new
6.0
CRAP 6.8
« lib/Rex/Resource/Common.pm ↑ Summary blib/lib/Rex/Interface/Fs/SSH.pm »
1 #
2 # (c) Jan Gehring <jan.gehring@gmail.com>
3 #
4  
5 package Rex::Test::Base::has_cron_env;
6  
7 1 ▶use v5.14.4;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 our $VERSION = '1.16.1'; # VERSION
11  
12 1 ▶use Rex -minimal;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Rex::Commands::Cron;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use base qw(Rex::Test::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
18 0 my $that = shift;
19 0 ▶ my $proto = ref($that) || $that;
Condition0%0/3
ref $that || $that
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $that || $that
ref $that $that
Truth table0%0/3
A || B
A= ref $thatB= $that
ABresult
1X1
011
000
20 0 my $self = {@_};
21  
22 0 bless( $self, $proto );
23  
24 0 my ( $pkg, $file ) = caller(0);
25  
26 0 return $self;
27 }
28  
29 0 ▶sub run_test {
Subroutine run_test: not called CC=3 SCAR=24.8
Pod undocumented
30 0 my ( $self, $user, $key, $value, $count ) = @_;
31  
32 0 my @envs = cron env => $user => "list";
33 0 ▶ my @matched_envs = grep { $_->{name} eq $key && $_->{value} eq $value } @envs;
Condition0%0/3
$_->{'name'} eq $key && $_->{'value'} eq $value
!ll&&!rl&&r
000
MC/DC0%0/2
$_->{'name'} eq $key && $_->{'value'} eq $value
$_->{'name'} eq $key $_->{'value'} eq $value
Truth table0%0/3
A && B
A= $_->{'name'} eq $keyB= $_->{'value'} eq $value
ABresult
0X0
100
111
34  
35 0 ▶ if ($count) {
Branch: 1 branch
BranchTrueFalseTotal
if ($count) { } 0 0 0
36 0 $self->ok( scalar @matched_envs == $count,
37 "Found $count cron(s) env entries with $key = $value" );
38 }
39 else {
40 0 $self->ok( scalar @matched_envs > 0,
41 "Found cron env entry with $key = $value" );
42 }
43 }
44  
45 0 ▶sub run_not_test {
Subroutine run_not_test: not called CC=3 SCAR=24.8
Pod undocumented
46 0 my ( $self, $user, $key, $value, $count ) = @_;
47  
48 0 my @envs = cron env => $user => "list";
49 0 ▶ my @matched_envs = grep { $_->{name} eq $key && $_->{value} eq $value } @envs;
Condition0%0/3
$_->{'name'} eq $key && $_->{'value'} eq $value
!ll&&!rl&&r
000
MC/DC0%0/2
$_->{'name'} eq $key && $_->{'value'} eq $value
$_->{'name'} eq $key $_->{'value'} eq $value
Truth table0%0/3
A && B
A= $_->{'name'} eq $keyB= $_->{'value'} eq $value
ABresult
0X0
100
111
50  
51 0 ▶ if ($count) {
Branch: 1 branch
BranchTrueFalseTotal
if ($count) { } 0 0 0
52 0 $self->ok( scalar @matched_envs != $count,
53 "Not found $count cron(s) env entries with $key = $value" );
54 }
55 else {
56 0 $self->ok( scalar @matched_envs == 0,
57 "Not found cron env entry with $key = $value" );
58 }
59 }
60  
61 1 1;
« lib/Rex/Resource/Common.pm ↑ Summary blib/lib/Rex/Interface/Fs/SSH.pm »