| 1 | # | ||||||||||||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||||||||||||
| 3 | # | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | package Rex::Test::Base::has_cron; | ||||||||||||||||||||
| 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
MC/DC0%0/2
ref $that || $that
ref $that
$that
Truth table0%0/3
A || B
A= ref $thatB= $that
| |||||||||||||||||||||
| 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=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 30 | 0 | my ( $self, $user, $key, $value, $count ) = @_; | |||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 0 | my @crons = cron list => $user; | |||||||||||||||||||
| 33 | 0 | my @matched_crons = grep { $_->{$key} eq $value } @crons; | |||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 0 | ▶ | if ($count) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 36 | 0 | $self->ok( scalar @matched_crons == $count, | |||||||||||||||||||
| 37 | "Found $count cron(s) with $key = $value" ); | ||||||||||||||||||||
| 38 | } | ||||||||||||||||||||
| 39 | else { | ||||||||||||||||||||
| 40 | 0 | $self->ok( scalar @matched_crons > 0, "Found cron with $key = $value" ); | |||||||||||||||||||
| 41 | } | ||||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 0 | ▶ | sub run_not_test { | ||||||||||||||||||
|
Subroutine
run_not_test: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 45 | 0 | my ( $self, $user, $key, $value, $count ) = @_; | |||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | 0 | my @crons = cron list => $user; | |||||||||||||||||||
| 48 | 0 | my @matched_crons = grep { $_->{$key} eq $value } @crons; | |||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 0 | ▶ | if ($count) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 51 | 0 | $self->ok( scalar @matched_crons != $count, | |||||||||||||||||||
| 52 | "Not found $count cron(s) with $key = $value" ); | ||||||||||||||||||||
| 53 | } | ||||||||||||||||||||
| 54 | else { | ||||||||||||||||||||
| 55 | 0 | $self->ok( scalar @matched_crons == 0, | |||||||||||||||||||
| 56 | "Not found cron with $key = $value" ); | ||||||||||||||||||||
| 57 | } | ||||||||||||||||||||
| 58 | } | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | 1 | 1; | |||||||||||||||||||