Branch Coverage

blib/lib/HTML/FormFu/Model/DBIC.pm
Criterion Covered Total %
branch 251 318 78.9


line true false branch
34 87 0 if defined $data_type
37 1 24 if (defined $enum_col)
43 24 0 unless (defined $id_col)
47 24 0 unless (defined $label_col)
52 73 0 if defined $data_type
55 0 24 unless defined $label_col
57 6 18 if (defined(my $from_stash = $attrs->{'condition_from_stash'}))
60 0 6 $condition ? :
63 0 6 if ref $from_stash->{$name}
70 8 16 if $condition
79 1 23 if ($attrs->{'localize_label'}) { }
81 2 0 $has_column ? :
88 72 0 $has_column ? :
103 22 3 if (defined $schema) { }
3 0 elsif (defined $context and defined $attrs->{'model'}) { }
0 0 elsif (defined $context) { }
112 0 3 if (defined(my $rs = $attrs->{'resultset'}))
121 0 0 if defined $model
131 32 33 defined $attrs->{'base'} ? :
136 6 0 if defined $attrs->{'nested_base'} and !defined($base->nested_name) || $base->nested_name ne $attrs->{'nested_base'}
151 556 498 if $base == $field
152 189 309 if defined $field->nested_name
163 1 0 unless defined $name or $config->{'accessor'}
164 44 197 unless is_direct_child($base, $field)
166 58 139 if $field->original_name
170 2 195 if (defined $accessor) { }
147 48 elsif ($dbic->can($name)) { }
177 0 147 if ($has_col and $has_rel) { }
134 13 elsif ($has_col) { }
9 4 elsif ($field->multi_value and $config->{'default_column'} || ref $dbic->$name && $dbic->$name->can('result_source')) { }
197 7 2 if (not defined $info or $info->{'attrs'}{'accessor'} eq 'multi') { }
217 3 194 if (defined(my $label = $config->{'label'}))
220 0 3 if ($has_rel) { }
238 235 49 if $block->is_field and not $block->is_block
239 0 49 unless $block->can('nested_name')
245 1 48 if (defined(my $label = $config->{'label'}) and $block->can('label'))
248 0 1 if ($has_rel) { }
259 23 26 unless defined $rel
267 6 1 unless $has_rel or $dbic->can($rel) and not $dbic->result_source->has_column($rel)
271 13 7 if ($block->is_repeatable and $block->increment_field_names) { }
278 3 12 defined $_->original_name ? :
280 0 13 unless grep {$pk eq (defined $_->original_name ? $_->original_name : $_->name);} @{$block->get_fields({'type', 'Hidden'});}
287 3 10 $config->{'empty_rows'} ? :
300 13 0 if (defined(my $param_name = $block->counter_name))
302 82 42 defined $_->original_name ? :
308 13 0 if defined $field
314 3 10 if ($config->{'empty_rows'})
319 3 0 $config->{'empty_rows'} ? :
331 2 3 if (defined $del_field)
338 6 1 if (defined(my $row = $dbic->$rel))
349 0 3 if @_ > 2
352 0 3 defined $attrs->{'base'} ? :
355 0 3 unless my $schema = $form->stash->{'schema'}
361 0 3 unless my $resultset = $attrs->{'resultset'} || $base->model_config->{'resultset'} || $form->model_config->{'resultset'}
373 0 107 unless defined $dbic
376 47 60 defined $attrs->{'base'} ? :
381 3 8 if defined $attrs->{'nested_base'} and !defined($base->nested_name) || $base->nested_name ne $attrs->{'nested_base'}
394 55 278 if (@fk_columns) { }
402 28 79 if (@belongs_to_rels)
409 1 106 unless _save_columns($base, $dbic, $form)
427 505 121 if $block->is_field
428 0 121 unless $block->can('nested_name')
431 41 80 unless defined $rel
433 53 27 unless $dbic->can($rel)
435 1 26 if grep {$rel eq $_;} @cols
436 22 4 if grep {$rel eq $_;} @rels
438 3 1 if $dbic->can('add_to_' . $rel)
440 1 0 if (defined(my $row = $dbic->$rel))
451 0 134 if $attrs->{'no_follow'}
458 34 298 if defined $attrs->{'from'} and $attrs->{'from'} eq $rs->related_source($rel)->result_class
463 9 23 if $_->is_field
466 268 7 unless defined $block or defined $multi_value
467 0 30 unless $form->valid($rel)
471 15 15 if (defined $block and $block->is_repeatable) { }
3 12 elsif (defined $combo) { }
8 4 elsif (defined $block and ref $params eq 'HASH') { }
4 0 elsif (defined $multi_value) { }
486 6 2 unless eval { do { $dbic->$rel } }
492 6 2 if (not defined $target and grep {length $_;} values %$params)
496 0 8 unless defined $target
505 2 6 unless ($dbic->$rel)
507 1 1 unless $attrs->{'no_update'}
532 2 2 if (exists $info->{'attrs'}{'is_foreign_key_constraint'}) { }
0 2 elsif ($info->{'attrs'}{'accessor'} and $info->{'attrs'}{'accessor'} eq 'multi') { }
551 2 2 if $fk_constraint
560 0 2 if $fpkey eq $fkey
565 0 2 if @fpkey > 1
586 1 1 if $updated != 1
606 2 1 if (defined $select_value and length $select_value) { }
638 2 0 if ($prim eq $key)
643 0 2 unless $found
647 2 0 if ($found)
651 2 0 if ($prim eq $key)
656 0 2 unless $found
666 0 15 unless $block->increment_field_names
674 0 15 unless grep {$_->original_name eq $pk;} @{$block->get_fields({'type', 'Hidden'});}
695 0 36 unless defined $pk_field
700 11 25 if (!defined($value) || $value eq '' and ($new_rows_max and ++$new_rows_counter <= $new_rows_max)) { }
3 22 elsif (not defined $value or $value eq '') { }
709 3 8 unless defined $row
717 0 30 unless defined $row
721 2 28 if _delete_has_many($form, $row, $rep)
737 3 8 unless _can_insert_new_row($dbic, $form, $config, $repetition, $rel, $pk_field)
758 2 10 if (@constraints) { }
765 1 1 if defined $_
767 1 1 if &notall(sub { length $_ if defined $_; } , map({$form->param_value($_->nested_name);} map({$_->parent;} @constraints)))
779 18 2 if defined $_
782 0 20 unless $result_source->has_column($_->original_name)
785 2 8 if &none(sub { length $_ if defined $_; } , map({$form->param_value($_->nested_name);} grep({$result_source->can($_->original_name) unless $result_source->has_column($_->original_name);} grep({defined $_->original_name;} @rep_fields))))
797 27 3 unless defined $del_field
802 1 2 unless $form->valid($nested_name) and $form->param_value($nested_name)
805 2 0 if $row->in_storage
817 222 27 if (defined $value)
818 1 8 if ($is_nullable && $data_type =~ /^timestamp|date|int|float|numeric/i || $field->model_config->{'null_if_empty'} and not ref $value and $value eq '')
831 3 25 if (not defined $value and defined $field and $field->isa('HTML::FormFu::Element::Checkbox') and not $is_nullable)
846 147 359 unless is_direct_child($base, $field)
849 1 358 if $config->{'delete_if_true'}
850 2 356 if $config->{'read_only'}
853 74 282 if $field->original_name
856 0 356 unless defined $accessor
860 5 351 $dbic->result_source->has_column($accessor) && exists $dbic->result_source->column_info($accessor)->{'is_array'} ? :
865 1 3 if $config->{'ignore_if_empty'} and !defined($value) || $value eq ''
870 17 338 if $name eq $pk and not defined $value && length $value
872 1 337 if ($config->{'delete_if_empty'} and not defined $value && length $value)
875 0 1 if $dbic->is_changed
876 1 0 if $dbic->in_storage
879 249 88 if ($dbic->result_source->has_column($accessor)) { }
2 86 elsif ($field->isa('HTML::FormFu::Element::Checkbox')) { }
885 1 1 unless (defined $value)
890 4 333 if (not $config->{'accessor'} and $dbic->result_source->has_relationship($accessor) and $dbic->result_source->has_column($accessor)) { }
253 80 elsif ($dbic->can($accessor) and not $dbic->result_source->relationship_info($accessor) and not $dbic->can('add_to_' . $accessor)) { }
915 46 60 if defined $parent->nested_name
920 172 101 if @{$base->get_fields('name', $valid);}
921 100 1 unless $dbic->can($valid)
936 8 55 defined $attrs->{'nested_base'} && defined $_->parent->nested_name ? :
944 38 8 if grep {$name eq $_;} @$rels, @$cols
946 8 0 if ($dbic->can($name))
949 2 6 unless &blessed($related) and $related->can('result_source')
953 0 6 if $form->has_errors($nested_name)
960 1 5 if $config->{'read_only'}
965 3 2 if (@values)
967 3 0 unless $pk =~ /\./
970 2 1 unless $config->{'condition'}
974 0 5 if ($config->{'additive'}) { }
990 1 4 if ($condition) { }
1013 22 604 if not $_->is_field and $_->is_repeatable
1019 0 22 unless defined $rel
1020 15 7 if grep {$rel eq $_;} @$rels, @$cols
1022 3 4 if ($dbic->can($rel))
1043 0 7 unless defined $pk_field
1056 1 6 if (!defined($value) || $value eq '' and ($new_rows_max and ++$new_rows_counter <= $new_rows_max)) { }
0 6 elsif (not defined $value or $value eq '') { }
1065 0 1 unless defined $row
1075 0 7 unless defined $row
1079 0 7 if _delete_many_to_many($form, $dbic, $row, $rel, $rep)
1089 1 6 if ($is_new)
1106 0 1 unless _can_insert_new_row($dbic, $form, $config, $repetition, $rel, $pk_field)
1122 7 0 unless defined $del_field
1127 0 0 unless $form->valid($nested_name) and $form->param_value($nested_name)