Branch Coverage

blib/lib/TestRail/API.pm
Criterion Covered Total %
branch 239 320 74.6


line true false branch
47 1 105 unless is_uri($apiurl)
74 56 49 if ($self->{'do_post_redirect'})
84 0 105 unless $self->{'encoding-nonaliased'}
90 0 105 unless grep {$_ eq $self->{'encoding-nonaliased'};} "Encode"->encodings(":all")
98 104 1 if $self->debug
103 1 0 unless ($userfetch_opts->{'skip_usercache'})
105 0 1 unless defined $res
106 1 0 if ((&reftype($res) || 'undef') ne "ARRAY")
107 0 1 unless &looks_like_number($res)
109 1 0 if $res == -500
112 0 0 if $res == -403
115 0 0 if $res == -401
116 0 0 if $res < 0
122 0 0 unless scalar @$res
158 111 1615 if $self->debug
165 632 1094 $data ? :
183 0 1726 if ($@)
186 0 0 if ($self->{'num_tries'} >= $self->{'max_tries'})
192 0 0 if $self->{'retry_delay'}
196 0 1726 unless defined $response
198 1 1725 if ($response->code == 403)
201 1 1724 if ($response->code == 401)
205 121 1603 if ($response->code != 200)
208 119 2 if ($self->{'num_tries'} >= $self->{'max_tries'})
218 1 1 if $self->{'retry_delay'}
228 9 0 if ($response->code == 200 and not $response->content) { }
234 0 0 unless ($self->debug)
251 6 72 if ref $self->{'user_cache'} eq "ARRAY" and scalar @{$self->{'user_cache'};}
252 56 16 $project_id ? :
254 10 60 if not $res or (&reftype($res) || 'undef') ne "ARRAY"
264 2 1 if ref $users ne "ARRAY"
266 1 0 if $usr->{'id'} == $user
276 2 1 if ref $users ne "ARRAY"
278 1 0 if $usr->{'name'} eq $user
288 2 1 if ref $users ne "ARRAY"
290 1 0 if $usr->{'email'} eq $email
299 1 6 unless scalar @$names
303 8 4 scalar @list ? :
305 1 5 unless scalar @$names == scalar @ret
344 6 100 if not $result or (&reftype($result) || 'undef') ne "HASH"
346 0 100 if not $projects or (&reftype($projects) || 'undef') ne "ARRAY"
364 0 120 if not $projects or (&reftype($projects) || 'undef') ne "ARRAY"
365 83 37 unless scalar @$projects
368 2 118 if not $projects or (&reftype($projects) || 'undef') ne "ARRAY"
370 117 115 if $candidate->{'name'} eq $project
382 6 1 unless scalar @$projects
385 2 5 if not $projects or (&reftype($projects) || 'undef') ne "ARRAY"
387 5 2 if $candidate->{'id'} eq $project
428 2 9 if not $suites or (&reftype($suites) || 'undef') ne "ARRAY"
433 9 0 if $suite->{'name'} eq $testsuite_name
453 0 3 if $parent_id
472 13 17 if $self->{'sections'}{$suite_id}
475 6 11 if not $response or (&reftype($response) || 'undef') ne "HASH"
477 0 11 if not $sections or (&reftype($sections) || 'undef') ne "ARRAY"
496 2 2 if not $sections or (&reftype($sections) || 'undef') ne "ARRAY"
498 2 4 if $sec->{'name'} eq $section_name
508 1 10 if not $sections_orig or (&reftype($sections_orig) || 'undef') ne "ARRAY"
511 25 25 $_->{'parent_id'} ? :
515 45 27 $_->{'parent_id'} ? :
523 0 12 unless my $sections = $self->getSections($project_id, $suite_id)
531 9 7 if defined $self->{'type_cache'}
534 4 3 if not $types or (&reftype($types) || 'undef') ne "ARRAY"
545 2 10 if not $types or (&reftype($types) || 'undef') ne "ARRAY"
547 10 6 if $type->{'name'} eq $name
572 0 3 if (defined $extras and &reftype($extras) eq "HASH")
574 0 0 if defined $extras->{'priority_id'}
576 0 0 if defined $extras->{'estimate'}
578 0 0 if defined $extras->{'milestone_id'}
580 0 0 if defined $extras->{'refs'}
584 0 3 if (defined $opts and &reftype($opts) eq "HASH")
618 7 15 if not $response or (&reftype($response) || 'undef') ne "HASH"
620 0 15 if not $cases or (&reftype($cases) || 'undef') ne "ARRAY"
630 3 1 if not $cases or (&reftype($cases) || 'undef') ne "ARRAY"
632 1 0 if $case->{'title'} eq $name
647 1 2 if $self->{'case_fields'}
666 2 2 if defined $self->{'priority_cache'}
669 1 1 if not $priorities or (&reftype($priorities) || 'undef') ne "ARRAY"
681 0 1 if not $priorities or (&reftype($priorities) || 'undef') ne "ARRAY"
684 1 0 if $priority->{'name'} eq $name
707 4 270 defined $case_ids ? :
735 4 107 unless (&reftype($initial_runs) || 'undef') eq "ARRAY"
746 0 22 unless (&reftype($initial_runs) || 'undef') eq "ARRAY"
765 0 134 if $limit > $self->{'global_limit'}
767 133 1 if defined $offset
768 133 1 if $limit
772 5 129 if not $response or (&reftype($response) || 'undef') ne "HASH"
774 0 129 if not $runs or (&reftype($runs) || 'undef') ne "ARRAY"
783 2 56 if not $runs or (&reftype($runs) || 'undef') ne "ARRAY"
785 37 141 if $run->{'name'} eq $name
807 1 13 unless scalar @$runs
819 65 52 $_->{'id'} < 6 ? :
832 837 2511 unless exists $shash{$status}
835 22599 0 if exists $shash{$status}
861 0 1 unless (&reftype($initial_results) || 'undef') eq "ARRAY"
872 0 0 unless (&reftype($initial_results) || 'undef') eq "ARRAY"
891 0 1 if $limit > $self->{'global_limit'}
893 0 1 if defined $offset
894 1 0 if $limit
907 2 2429 unless defined $plan->{'entries'} and (&reftype($plan->{'entries'}) || 'undef') eq "ARRAY"
913 2458 0 if defined $entry->{'runs'} and (&reftype($entry->{'runs'}) || 'undef') eq "ARRAY"
927 2 38 if $testsuite_id
928 1 39 unless $runs
933 38 1 if (defined $configurations)
941 0 39 if defined $configurations and scalar @pconfigs != scalar @$configurations
947 3 35 if $run->{'name'} ne $name
948 1 34 if scalar @pconfigs != scalar @{$run->{'config_ids'};}
953 31 2 if grep {$_ == $cid;} @pconfigs
956 32 2 if $found == scalar @{$run->{'config_ids'};}
997 4 100 unless (&reftype($initial_plans) || 'undef') eq "ARRAY"
1008 0 19 unless (&reftype($initial_plans) || 'undef') eq "ARRAY"
1027 0 124 if $limit > $self->{'global_limit'}
1029 123 1 if defined $offset
1030 123 1 if $limit
1034 5 119 if not $response or (&reftype($response) || 'undef') ne "HASH"
1036 0 119 if not $plans or (&reftype($plans) || 'undef') ne "ARRAY"
1045 2 47 if not $plans or (&reftype($plans) || 'undef') ne "ARRAY"
1047 39 817 if ($plan->{'name'} eq $name)
1075 45 54 unless defined $ret->{'totals'}{$key}
1083 0 45 if grep {$_ eq $key;} "plan", "configs", "percentages"
1103 1 10 defined $case_ids ? :
1111 1 10 defined $case_ids ? :
1164 4 2 if not $response or (&reftype($response) || 'undef') ne "HASH"
1166 0 2 if not $milestones or (&reftype($milestones) || 'undef') ne "ARRAY"
1176 2 1 if not $milestones or (&reftype($milestones) || 'undef') ne "ARRAY"
1179 1 0 if $milestone->{'name'} eq $name
1200 7 0 if defined $status_ids and scalar @$status_ids
1205 4 87 if not $response or (&reftype($response) || 'undef') ne "HASH"
1207 0 87 if not $results or (&reftype($results) || 'undef') ne "ARRAY"
1210 6 0 if defined $assignedto_ids and scalar @$assignedto_ids
1211 8 14 if defined $aid
1228 48 1 unless $tests
1229 2 47 if not $tests or (&reftype($tests) || 'undef') ne "ARRAY"
1231 46 91 if $test->{'title'} eq $name
1247 3 17 if defined $self->{'tr_fields'}
1259 2 15 unless scalar @candidates
1260 0 15 if ref $candidates[0] ne "HASH"
1263 0 15 if ref $candidates[0]{'configs'} ne "ARRAY" and not scalar @{$candidates[0]{'configs'};}
1267 1 14 unless defined $project_id
1273 13 21 if grep {$_ == $project_id;} @{$$config{"context"}{"project_ids"};}
1282 30 81 if $self->{'status_cache'}
1310 123 404 if ($member->{'name'} eq $name)
1316 4 93 unless scalar @$names == scalar @ret
1337 44 10 if (defined $opts and &reftype($opts) eq "HASH")
1339 8 36 defined $opts->{'version'} ? :
1341 13 31 defined $opts->{'elapsed'} ? :
1344 0 44 defined $opts->{'defects'} ? :
1348 0 44 defined $opts->{'assignedto_id'} ? :
1353 7 47 if (defined $custom_fields and &reftype($custom_fields) eq "HASH")
1390 8 3 if $limit
1391 0 11 if defined $offset
1394 2 9 if not $response or (&reftype($response) || 'undef') ne "HASH"
1396 0 9 if not $results or (&reftype($results) || 'undef') ne "ARRAY"
1409 0 0 if $limit
1410 0 0 if defined $offset
1429 0 4 if ref $cgroups ne "ARRAY"
1431 3 1 unless scalar @$cgroups
1465 3 190 unless (&reftype($cgroups) || 'undef') eq "ARRAY"
1498 0 60 unless my $configs = $self->getConfigurations($project_id)
1539 0 29 if (ref $filters->{$filter} eq 'ARRAY') { }
1545 21 8 if defined $filters->{$filter}