Branch Coverage

blib/lib/Dancer/Plugin/SimpleCRUD.pm
Criterion Covered Total %
branch 102 234 43.5


line true false branch
15 0 0 if (not @args) { }
0 0 elsif (@args == 1) { }
0 0 elsif ($args == 2) { }
16 0 0 if not $paramname
530 0 7 unless ($dbh)
535 0 7 unless ($args{'prefix'})
536 0 7 unless ($args{'prefix'} =~ m[^/])
548 0 7 unless ($args{'db_table'})
552 0 7 if not exists $args{'deletable'} and exists $args{'deleteable'}
557 0 7 unless exists $args{'editable'}
558 6 1 unless exists $args{'addable'}
559 7 0 unless exists $args{'query_auto_focus'}
566 0 14 if /--/
575 2 5 if ($args{'editable'})
583 1 6 if ($args{'addable'})
605 0 2 if ($args{'editable'} and $args{'deletable'})
649 0 0 unless my $rows_deleted = $dbh->quick_delete($table_name, $where)
652 0 0 if ($rows_deleted)
677 0 2 unless my $id = $params->{'id'}
722 5 1 if (defined $id)
727 3 2 unless ($values_from_database)
738 0 3 if ($args->{'editable_columns'}) { }
750 0 3 if ($args->{'not_editable_columns'})
760 0 6 if $validation->{$field}
761 0 6 if ($field =~ /email/)
770 0 3 if (exists $args->{'required'}) { }
785 0 9 if (my $values_specified = $args->{'acceptable_values'}{$name}) { }
0 9 elsif (my $foreign_key = $args->{'foreign_keys'}{$name}) { }
0 9 elsif (my $values_from_db = $field->{'mysql_values'}) { }
789 0 0 if (ref $values_specified eq 'CODE')
815 0 3 request()->{'method'} eq 'POST' ? :
831 1 2 params()->{'id'} ? :
846 0 2 exists $args->{'default_value'}{$field} ? :
0 2 exists params()->{$field} ? :
4 2 exists $values_from_database->{$field} ? :
855 0 6 if ($constrain_values{$field})
869 0 30 if (my $val = $args->{$arg_name}{$field})
876 3 3 if ($field =~ /pass(?:wd|word)?$/i)
881 0 6 if ($field_type{$field} eq 'TEXT')
887 0 6 if (my $override_type = $args->{'input_types'}{$field})
898 0 6 if (ref $field_params{'options'} eq 'ARRAY')
899 0 0 if (ref $field_params{'options'}[0] eq 'ARRAY')
900 0 0 if (@{$field_params{'options'}[0];} == 3)
912 0 3 if (request()->{'method'} eq 'POST' and $form->submitted and $form->validate) { }
932 0 0 if (exists params('route')->{'id'}) { }
954 0 0 if ($success) { }
995 0 14 if (ref $display_columns eq 'ARRAY')
999 0 0 if (grep {$_ eq $col->{'COLUMN_NAME'};} @$display_columns)
1004 0 0 if (@filtered_columns)
1014 0 42 if ($args->{'labels'}{$_->{'COLUMN_NAME'}})
1019 14 28 $searchfield eq $_->{'COLUMN_NAME'} ? :
1044 14 126 $sel ? :
1063 14 0 if ($args->{'query_auto_focus'})
1087 1 13 if ($args->{'foreign_keys'})
1093 0 0 if ($seen_table->{$raw_ftable}++)
1111 0 14 if (ref $args->{'custom_columns'} eq 'HASH')
1123 3 11 unless $args->{'custom_columns'}
1125 4 7 unless (grep {$column_alias eq $_;} @select_cols)
1127 0 4 unless my $raw_column = $custom_col_spec->{'raw_column'}
1129 4 0 if ($raw_column =~ /^[\w_]+$/) { }
1150 2 12 $args->{'editable'} ? :
1156 1 13 if ($args->{'foreign_keys'})
1166 0 0 if (my $alias = $fk_alias{$col})
1178 4 10 if (length $q or $where_filter)
1186 4 0 if (length $q)
1196 4 0 if ($column_data)
1198 0 4 if ($st eq 'c' or $st eq 'nc') { }
0 4 elsif ($st eq 'b') { }
1227 0 14 if ($args->{'downloadable'})
1247 4 10 if ($args->{'sortable'})
1255 0 4 unless $valid
1259 0 4 exists params()->{'d'} && params()->{'d'} eq 'desc' ? :
1262 4 0 $order_by_direction eq 'asc' ? :
1273 0 12 if ($args->{'labels'}{$col_name}) { }
1278 4 8 if ($col_name eq $order_by_column)
1280 0 4 $direction eq 'asc' ? :
1295 4 0 if (exists $args->{'custom_columns'})
1299 2 5 unless (grep {$_ eq $custom_column_name;} @all_cols)
1306 0 0 if (exists $args->{'foreign_keys'} and exists $args->{'foreign_keys'}{$order_by_column})
1318 0 14 if ($args->{'paginate'} and $args->{'paginate'} =~ /^\d+$/)
1327 0 0 unless $page =~ /^\d+$/
1337 0 0 if ($page > 0) { }
1361 0 14 unless $sth->execute(@binds)
1365 0 0 if ($args->{'downloadable'} and params()->{'format'})
1372 3 11 unless $args->{'custom_columns'}
1389 16 0 if ($args->{'editable'} and _has_permission('edit', $args))
1397 0 16 if ($args->{'deletable'} and _has_permission('edit', $args))
1420 0 14 unless $args->{'custom_columns'}
1421 11 0 if (my $column_class = $custom_col_spec->{'column_class'})
1423 0 11 if $first_index == -1
1430 1 13 if ($args->{'addable'} and _has_permission('edit', $args))
1463 0 19 if ($template) { }
1477 0 0 if (params()->{'o'})
1483 0 0 if (length $q)
1488 0 0 if (params()->{'p'})
1495 0 0 if ($format eq 'tabular') { }
0 0 elsif ($format eq 'csv') { }
0 0 elsif ($format eq 'json') { }
0 0 elsif ($format eq 'xml') { }
1507 0 0 if $@
1553 0 19 unless my $sth = $dbh->column_info(undef, undef, $table_name, undef)
1562 0 19 unless @columns
1588 0 37 if (plugin_setting()->{'use_old_url_scheme'}) { }
1604 0 17 if (keys %$auth_settings) { }
1605 0 0 unless 'Dancer::ModuleLoader'->load('Dancer::Plugin::Auth::Extensible')
1615 0 0 if ($auth_settings->{'require_login'}) { }
1620 0 0 if (my $val = $auth_settings->{$keyword})
1636 0 17 if (keys %$auth_settings) { }
1637 0 0 unless 'Dancer::ModuleLoader'->load('Dancer::Plugin::Auth::Extensible')
1645 0 0 if ($auth_settings->{'require_login'})
1646 0 0 Dancer::Plugin::Auth::Extensible::logged_in_user() ? :
1649 0 0 if (my $need_role = $auth_settings->{'require_role'})
1660 4 10 defined $v ? :
1669 21 0 unless $args->{'where_filter'}
1671 0 0 if (ref $args->{'where_filter'} eq 'HASH') { }
0 0 elsif (ref $args->{'where_filter'} eq 'CODE') { }
1675 0 0 if (ref $result eq 'HASH') { }