Branch Coverage

blib/lib/RT/Client/REST.pm
Criterion Covered Total %
branch 73 156 46.7


line true false branch
41 35 118 if (@_)
65 13 18 if ($k eq "server")
80 1 4 unless (scalar keys %opts > 0)
86 4 0 if (defined $opts{'username'})
87 4 0 if (defined $opts{'password'})
97 0 4 unless $_->blessed and $_->can("rethrow")
100 4 0 if (grep {$err->isa($_);} "RT::Client::REST::AuthenticationFailureException", "RT::Client::REST::MalformedRTResponseException", "RT::Client::REST::RequestTimedOutException", "RT::Client::REST::HTTPException")
108 0 0 if (not $err->isa("Exception::Class::Base"))
125 0 1 if (grep {$type eq $_;} 'user', 'queue', 'group') { }
135 0 0 if (not @$o and $c)
157 0 0 if (not @$o and $c)
179 0 0 if (not @$o and $c)
185 0 0 defined $c[1] && $c[1] eq '(Unnamed)' ? :
202 3 3 if ($opts{'undecoded'}) { }
212 0 6 if (not @$o and $c)
234 0 0 if (not @$o and $c)
247 0 0 if ($val =~ m[^fsck\.com-\w+\://(.*?)/(.*?)/(\d+)$]) { }
260 0 0 unless $_->blessed and $_->can("rethrow")
262 0 0 if (not $_->isa("RT::Client::REST::InvalidParameterValueException"))
284 1 0 if (not defined $tr_type) { }
0 0 elsif ('ARRAY' eq ref $tr_type) { }
309 0 0 unless (length $e)
311 0 0 unless ($ex->message =~ m[^0/])
337 0 0 if (not @$o and $c)
355 0 2 if (defined $format)
356 0 0 if $format ne "s"
359 2 0 defined $orderby ? :
0 2 defined $format ? :
365 0 0 if (defined $format and $format eq "s")
385 1 0 unless ("new" eq $id)
390 1 0 if (defined(my $set = delete $opts{'set'}))
395 0 1 if (defined(my $text = delete $opts{'text'}))
407 0 0 if ($r->decoded_content =~ /not/)
415 0 0 if ($r->decoded_content =~ /^#[^\d]+(\d+) (?:created|updated)/) { }
442 0 4 if (exists $opts{'html'})
443 0 0 if ($opts{'html'})
450 0 4 if (exists $opts{'cc'})
455 0 4 if (exists $opts{'bcc'})
461 2 2 if (exists $opts{'attachments'})
463 0 2 unless ("ARRAY" eq ref $files)
472 2 0 unless (-f $files->[$i] and -r _)
510 0 0 exists $opts{'unlink'} ? :
549 0 0 if ($e)
564 9 19 if (defined $content)
565 8 1 ref $content ? :
586 22 6 unless ($self->_cookie or $self->basic_auth_cb)
587 11 11 unless (defined $auth)
596 11 6 if (@$data) { }
598 45 1 unless ref $_
606 0 17 if ($self->_cookie)
615 8 9 if ($res->is_success) { }
5 4 elsif (500 == $res->code and ($res->decoded_content || $res->message) =~ /read timeout/) { }
2 2 elsif (302 == $res->code and not $self->{'_redirected'}) { }
625 1 7 unless ($status =~ m[^RT/\d+(?:\S+) (\d+) ([\w\s]+)$])
627 1 0 if ($self->verbose_errors)
641 0 7 if ($res->header("set-cookie"))
647 0 7 unless ($res->is_success)
650 0 0 if ($res->code == 401) { }
652 0 0 if (exists $d{'user'}) { }
0 0 elsif ($req->header('Cookie')) { }
703 2 0 if ($self->verbose_errors)
718 11 10 unless (exists $self->{'_ua'})
721 0 11 unless ref $args eq "HASH"
728 11 0 if ($self->timeout)
731 3 8 if ($self->basic_auth_cb)
747 6 42 if (@_)
749 2 4 unless ("CODE" eq ref $sub)
766 2 71 if (@_)
769 1 5 unless ($new_logger->can($method))
792 0 12 unless ($type =~ /^[A-Za-z0-9_.-]+$/)
804 0 0 unless ("ARRAY" eq ref $objects)
816 0 20 unless ($id =~ /^\d+$/)
828 0 4 unless (grep {$_ eq lc $action;} "comment", "correspond")
840 0 4 unless (defined $message and length $message)
854 0 0 unless (grep {lc $type eq lc $_;} @types)
866 0 0 unless (grep {$type eq $_;} $self->_list_of_valid_transaction_types)
878 0 49 if @_ & 1
886 0 24 unless (defined $server)