Branch Coverage

blib/lib/Dancer/Plugin/SimpleCRUD.pm
Criterion Covered Total %
branch 105 234 44.8


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 8 unless ($dbh)
535 0 8 unless ($args{'prefix'})
536 0 8 unless ($args{'prefix'} =~ m[^/])
548 0 8 unless ($args{'db_table'})
552 0 8 if not exists $args{'deletable'} and exists $args{'deleteable'}
557 0 8 unless exists $args{'editable'}
558 7 1 unless exists $args{'addable'}
559 8 0 unless exists $args{'query_auto_focus'}
566 0 16 if /--/
575 3 5 if ($args{'editable'})
584 2 6 if ($args{'addable'})
607 0 3 if ($args{'editable'} and $args{'deletable'})
651 0 0 unless my $rows_deleted = $dbh->quick_delete($table_name, $where)
654 0 0 if ($rows_deleted)
680 0 2 unless my $id = $params->{'id'}
725 5 1 if (defined $id)
730 3 2 unless ($values_from_database)
741 0 3 if ($args->{'editable_columns'}) { }
753 0 3 if ($args->{'not_editable_columns'})
763 0 6 if $validation->{$field}
764 0 6 if ($field =~ /email/)
773 0 3 if (exists $args->{'required'}) { }
788 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'}) { }
792 0 0 if (ref $values_specified eq 'CODE')
818 0 3 request()->{'method'} eq 'POST' ? :
834 1 2 params()->{'id'} ? :
849 0 2 exists $args->{'default_value'}{$field} ? :
0 2 exists params()->{$field} ? :
4 2 exists $values_from_database->{$field} ? :
858 0 6 if ($constrain_values{$field})
872 0 30 if (my $val = $args->{$arg_name}{$field})
879 3 3 if ($field =~ /pass(?:wd|word)?$/i)
884 0 6 if ($field_type{$field} eq 'TEXT')
890 0 6 if (my $override_type = $args->{'input_types'}{$field})
901 0 6 if (ref $field_params{'options'} eq 'ARRAY')
902 0 0 if (ref $field_params{'options'}[0] eq 'ARRAY')
903 0 0 if (@{$field_params{'options'}[0];} == 3)
915 0 3 if (request()->{'method'} eq 'POST' and $form->submitted and $form->validate) { }
935 0 0 if (exists params('route')->{'id'}) { }
957 0 0 if ($success) { }
998 0 14 if (ref $display_columns eq 'ARRAY')
1002 0 0 if (grep {$_ eq $col->{'COLUMN_NAME'};} @$display_columns)
1007 0 0 if (@filtered_columns)
1017 0 42 if ($args->{'labels'}{$_->{'COLUMN_NAME'}})
1022 14 28 $searchfield eq $_->{'COLUMN_NAME'} ? :
1047 14 126 $sel ? :
1066 14 0 if ($args->{'query_auto_focus'})
1090 1 13 if ($args->{'foreign_keys'})
1096 0 0 if ($seen_table->{$raw_ftable}++)
1114 0 14 if (ref $args->{'custom_columns'} eq 'HASH')
1126 3 11 unless $args->{'custom_columns'}
1128 4 7 unless (grep {$column_alias eq $_;} @select_cols)
1130 0 4 unless my $raw_column = $custom_col_spec->{'raw_column'}
1132 4 0 if ($raw_column =~ /^[\w_]+$/) { }
1153 2 12 $args->{'editable'} ? :
1159 1 13 if ($args->{'foreign_keys'})
1169 0 0 if (my $alias = $fk_alias{$col})
1181 4 10 if (length $q or $where_filter)
1189 4 0 if (length $q)
1199 4 0 if ($column_data)
1201 0 4 if ($st eq 'c' or $st eq 'nc') { }
0 4 elsif ($st eq 'b') { }
1230 0 14 if ($args->{'downloadable'})
1250 4 10 if ($args->{'sortable'})
1258 0 4 unless $valid
1262 0 4 exists params()->{'d'} && params()->{'d'} eq 'desc' ? :
1265 4 0 $order_by_direction eq 'asc' ? :
1276 0 12 if ($args->{'labels'}{$col_name}) { }
1281 4 8 if ($col_name eq $order_by_column)
1283 0 4 $direction eq 'asc' ? :
1298 4 0 if (exists $args->{'custom_columns'})
1302 2 5 unless (grep {$_ eq $custom_column_name;} @all_cols)
1309 0 0 if (exists $args->{'foreign_keys'} and exists $args->{'foreign_keys'}{$order_by_column})
1321 0 14 if ($args->{'paginate'} and $args->{'paginate'} =~ /^\d+$/)
1330 0 0 unless $page =~ /^\d+$/
1340 0 0 if ($page > 0) { }
1364 0 14 unless $sth->execute(@binds)
1368 0 0 if ($args->{'downloadable'} and params()->{'format'})
1375 3 11 unless $args->{'custom_columns'}
1392 16 0 if ($args->{'editable'} and _has_permission('edit', $args))
1400 0 16 if ($args->{'deletable'} and _has_permission('edit', $args))
1423 0 14 unless $args->{'custom_columns'}
1424 11 0 if (my $column_class = $custom_col_spec->{'column_class'})
1426 0 11 if $first_index == -1
1433 1 13 if ($args->{'addable'} and _has_permission('edit', $args))
1466 0 19 if ($template) { }
1480 0 0 if (params()->{'o'})
1486 0 0 if (length $q)
1491 0 0 if (params()->{'p'})
1498 0 0 if ($format eq 'tabular') { }
0 0 elsif ($format eq 'csv') { }
0 0 elsif ($format eq 'json') { }
0 0 elsif ($format eq 'xml') { }
1510 0 0 if $@
1556 0 19 unless my $sth = $dbh->column_info(undef, undef, $table_name, undef)
1565 0 19 unless @columns
1591 0 37 if (plugin_setting()->{'use_old_url_scheme'}) { }
1607 4 17 if (keys %$auth_settings) { }
1608 0 4 unless 'Dancer::ModuleLoader'->load('Dancer::Plugin::Auth::Extensible')
1618 4 0 if ($auth_settings->{'require_login'}) { }
1623 0 0 if (my $val = $auth_settings->{$keyword})
1639 0 17 if (keys %$auth_settings) { }
1640 0 0 unless 'Dancer::ModuleLoader'->load('Dancer::Plugin::Auth::Extensible')
1648 0 0 if ($auth_settings->{'require_login'})
1649 0 0 Dancer::Plugin::Auth::Extensible::logged_in_user() ? :
1652 0 0 if (my $need_role = $auth_settings->{'require_role'})
1663 4 10 defined $v ? :
1672 21 0 unless $args->{'where_filter'}
1674 0 0 if (ref $args->{'where_filter'} eq 'HASH') { }
0 0 elsif (ref $args->{'where_filter'} eq 'CODE') { }
1678 0 0 if (ref $result eq 'HASH') { }