Branch Coverage

blib/lib/ORM.pm
Criterion Covered Total %
branch 194 356 54.4


line true false branch
99 0 21 defined $arg{'history'} ? :
101 0 21 if ($class->_is_intermediate)
106 21 0 unless ($error->fatal)
112 0 21 if $arg{'temporary'}
117 160 0 exists $arg{'prop'}{$prop} ? :
131 21 0 unless ($error->fatal)
137 21 0 unless ($arg{'temporary'} or $error->fatal)
145 0 21 unless ($error->fatal or $$self{'_ORM_data'}{'id'})
151 2 19 if (not $error->fatal and $history)
157 21 0 unless $error->fatal
161 0 21 $error->fatal ? :
225 2 0 defined $arg{'lazy_load'} ? :
226 0 2 ref $arg{'order'} eq 'ARRAY' ? :
230 2 0 unless (wantarray or $arg{'return_ref'} or $arg{'return_res'})
236 1 1 if ($class->_is_sealed or $lazy_load or $arg{'return_res'}) { }
251 1 0 unless ($arg{'return_res'} or $error->fatal)
268 1 0 unless ($error->fatal)
274 0 1 if (ref $data eq 'HASH') { }
292 0 2 wantarray ? :
0 2 $arg{'return_ref'} ? :
0 2 $arg{'return_res'} ? :
312 3 0 unless ($self)
317 4 0 if (scalar $class->_db_table_fields($table))
324 1 2 unless ($arg{'lazy_load'})
328 0 1 if ref $self eq 'ORM::Broken' or $error->fatal
332 3 0 if $self
356 0 0 if ($class->_has_prop($prop)) { }
367 0 0 unless ($error->fatal)
377 0 0 unless ($error->fatal)
379 0 0 if (@obj > 1)
384 0 0 unless ($error->fatal)
386 0 0 unless (@obj)
393 0 0 $error->fatal ? :
429 0 6 defined $arg{'history'} ? :
437 6 0 unless ($error->fatal)
440 2 4 if ($arg{'old_prop'})
450 0 4 if $error->fatal
451 1 3 if ($self->_values_are_not_equal($$self{'_ORM_data'}{$prop}, $old_normalized))
466 5 1 unless ($error->fatal)
470 7 14 if (exists $arg{'prop'}{$prop})
472 1 6 if (UNIVERSAL::isa($arg{'prop'}{$prop}, 'ORM::Expr')) { }
484 0 6 if $error->fatal
485 6 0 if ($self->_values_are_not_equal($$self{'_ORM_data'}{$prop}, $new_normalized))
496 4 2 if (%changed_prop and not $error->fatal)
501 5 1 unless ($error->fatal)
506 6 15 if ($self->_values_are_not_equal($old_prop{$prop}, $$self{'_ORM_data'}{$prop})) { }
1 14 elsif (exists $expr_prop{$prop}) { }
509 0 6 if exists $expr_prop{$prop}
518 5 0 if (not $self->is_temporary || $error->fatal and scalar %changed_prop)
526 5 0 unless ($error->fatal)
538 5 0 if ($history and not $error->fatal)
542 5 0 if ($history and not $error->fatal)
562 1 5 if ($error->fatal)
581 0 2 defined $arg{'history'} ? :
583 2 0 unless ($self->is_temporary)
585 2 0 unless ($error->fatal)
588 2 0 if ($history)
593 2 0 unless ($error->fatal)
602 2 0 unless ($error->fatal)
624 0 0 if (scalar $class->_db_table_fields($table))
648 7 0 if (exists $$self{'_ORM_missing_tables'} and !defined($prop) || defined $prop_table && $$self{'_ORM_missing_tables'}{$prop_table} && (!(ref $$self{'_ORM_missing_tables'}{$prop_table} eq 'HASH') || $$self{'_ORM_missing_tables'}{$prop_table}{$prop}))
677 0 7 if ($error->fatal) { }
0 7 elsif (not $data) { }
679 0 0 if ($arg{'error'}) { }
697 3 4 if (exists $$data{'class'})
711 2 14 if ($new_class and $new_class ne $class)
715 2 0 if (UNIVERSAL::isa($new_class, $class)) { }
727 1 1 unless defined $prop
741 0 0 unless ref $_[0]
751 0 0 if (defined $arg{'value'})
767 0 57 $_[0]->_is_initial ? :
775 7 14 if ($prop) { }
820 0 29 if (@_)
822 0 0 if (defined $_[0]) { }
824 0 0 if ($class->_class_info) { }
835 0 0 if $class->_class_info
839 19 10 exists $class->_class_info->{'HISTORY_IS_ENABLED'} ? :
856 0 0 if (@_)
858 0 0 if (defined $_[0]) { }
868 0 0 exists $class->_class_info->{'PREFER_LAZY_LOAD'} ? :
878 195 0 if exists $class->_class_info->{'PROP'}{$prop}
887 23 48 if $pclass and $class->_class_hier->{$pclass}
914 2 4 if ($class->_class_info->{'BASE_CLASS'})
928 0 0 unless $class->_class_info->{'REV_REFS'}{$rev_class . ' ' . $rev_prop} or $rev_class->base_class and $class->_has_rev_ref($rev_class->base_class, $rev_prop)
962 0 1 ref $arg{'order'} eq 'ARRAY' ? :
963 1 0 $arg{'preload'} ? :
968 0 1 unless (%{$arg{'data'};})
973 1 0 unless ($error->fatal)
976 0 1 if ($arg{'count'}) { }
1 0 elsif (%preload) { }
984 0 2 if (not UNIVERSAL::isa($arg{'data'}{$name}, 'ORM::Metaprop')) { }
2 0 elsif ($arg{'data'}{$name}->_prop_ref_class and $preload{$name}) { }
995 2 11 if ($prop eq 'id') { }
1018 0 0 if (UNIVERSAL::isa($data{$name}, 'ORM::Metaprop') and $data{$name}->_prop_class) { }
1049 1 0 if ($res and not $error->fatal)
1051 0 1 if ($arg{'count'}) { }
1065 1 0 unless ($arg{'return_res'})
1072 0 1 if ($error->fatal)
1105 0 25 @_ == 1 ? :
1106 0 25 @_ == 1 ? :
1113 0 25 if (exists $arg{'new_value'}) { }
1119 3 22 if (exists $$self{'_ORM_missing_tables'})
1124 25 0 unless ($error->fatal)
1126 0 25 if ($prop eq 'class' and $class->_is_sealed) { }
25 0 elsif ($class->_plain_prop($prop)) { }
0 0 elsif ($pclass = $class->_prop_class($prop)) { }
1136 0 0 if (defined $$self{'_ORM_data'}{$prop})
1138 0 0 unless (exists $$self{'_ORM_cache'}{$prop})
1176 160 0 if (@_ == 1) { }
1186 0 160 if ($prop eq 'class') { }
1192 0 160 if (exists $$self{'_ORM_missing_tables'})
1210 0 0 if (ref($self)->_has_rev_ref($rev_class, $rev_prop))
1225 0 0 if (ref($self)->_has_rev_ref($rev_class, $rev_prop))
1241 25 0 if ($ORM::AUTOLOAD =~ /^(.+)::(.+)$/)
1247 0 25 unless ref $self
1274 3 0 if ($$prop{'id'})
1276 3 0 if ($$prop{'class'}) { }
1281 3 0 if ($result_tables)
1312 2 0 if ($arg{'deleted'}) { }
0 0 elsif ($arg{'error'} and $arg{'error'}->fatal) { }
1344 0 170 if (not $class->_has_prop($prop_name)) { }
132 38 elsif ($class->_plain_prop($prop_name)) { }
19 19 elsif ($class->_prop_is_ref($prop_name)) { }
1350 0 132 if ($prop_ref)
1360 9 10 if (not defined $prop_value) { }
0 10 elsif (not $prop_ref) { }
10 0 elsif (UNIVERSAL::isa($prop_ref, $class->_prop_class($prop_name))) { }
1371 0 0 unless ($obj)
1397 0 19 if (not defined $prop_value) { }
19 0 elsif (not $prop_ref) { }
0 0 elsif (UNIVERSAL::isa($prop_ref, $class->_prop_class($prop_name))) { }
1408 19 0 defined $obj ? :
1426 0 170 $arg{'error'}->fatal ? :
1446 0 0 if (ref($self)->_has_prop($prop))
1476 0 4 unless exists $arg{'db'}
1477 0 4 unless $arg{'db'}
1478 0 4 unless UNIVERSAL::isa($arg{'db'}, 'ORM::Db')
1479 0 4 unless exists $arg{'prefer_lazy_load'}
1480 0 4 unless exists $arg{'emulate_foreign_keys'}
1481 0 4 unless exists $arg{'default_cache_size'}
1517 5 5 if ($base) { }
1519 0 5 if ($class->_is_sealed) { }
1552 10 0 unless ($error->fatal)
1558 2 8 if (exists $arg{'history_is_enabled'}) { }
0 8 elsif (exists $$base{'HISTORY_IS_ENABLED'}) { }
1568 0 10 if (exists $arg{'prefer_lazy_load'})
1577 10 0 if ($table)
1585 2 8 if ($class->_history_class and $arg{'derived_class'} eq $class->_history_class)
1590 1 9 unless (scalar %$struct)
1599 9 1 if ($table)
1602 9 0 unless ($error->fatal)
1604 0 9 unless (exists $$struct{'id'})
1609 9 0 unless ($error->fatal)
1611 2 7 if ($class->_class_is_primary($arg{'derived_class'}) and not exists $$struct{'class'})
1621 9 0 unless ($error->fatal)
1623 4 5 unless ($class->_class_is_primary($arg{'derived_class'}))
1625 0 4 if $$derived{'TABLES_INNER_JOIN'}
1635 9 0 unless ($error->fatal)
1644 5 4 unless $$derived{'PROP2TABLE_MAP'}{'id'}
1649 34 0 if (not $$derived{'PROP2FIELD_MAP'}{$field}) { }
1652 31 3 if ($field ne 'class')
1675 9 0 unless ($error->fatal)
1677 4 5 unless ($class->_class_is_primary($arg{'derived_class'}))
1687 9 1 unless ($error->fatal)
1691 9 0 unless (eval "require $$derived{'METAPROP_CLASS'}")
1693 4 5 if ($$derived{'BASE_CLASS'}) { }
1706 9 1 unless ($error->fatal)
1713 3 28 if ($pclass and not $class->_class_hier->{$pclass})
1720 1 1 unless $class->_class_hier->{$$pclass{'class'}}
1736 2 4 if ($pclass and $class->_class_hier->{$pclass} and not $pclass->_class_info->{'REV_REFS'}{$key})
1746 3 28 if ($pclass and not $class->_class_hier->{$pclass})
1754 1 9 if $error->any
1769 28 3 unless defined $val1 xor defined $val2
1813 0 43 if (lc $type eq 'date') { }
2 41 elsif (lc $type eq 'datetime') { }
0 41 elsif (lc $type eq 'timestamp') { }
1836 0 5 unless ($class->_class_hier->{$load_class})
1846 0 0 if exists $_[0]->_class_hier->{'PRIMARY_CLASS'} and $_[0]->_cache