Branch Coverage

blib/lib/Test/PONAPI/Repository/MockDB.pm
Criterion Covered Total %
branch 89 118 75.4


line true false branch
45 13 0 unless $params->{'skip_data_load'}
56 88 0 if (my $table = $self->tables->{$type})
65 160 0 if (my $table = $self->tables->{$type})
67 0 160 unless exists $relations->{$rel_name}
80 46 10 unless grep((!exists $columns{$_}), @$fields)
88 5 49 if $args{'page'}
105 1 3 if $page
108 1 3 if (@$sort)
109 0 1 if @$sort > 1 or not $sort->[0] =~ /\A(-)?id\z/
119 1 0 $desc ? :
128 0 4 unless $rels
0 4 unless @{[] unless $rels;}
132 1 3 if $page
145 1 5 if $page
156 0 6 unless @$rels
190 2 3 unless (eval { do { $self->_create(%args); 1 } })
194 2 3 if ($failed)
223 2 0 if ref $rel_data ne 'ARRAY'
257 2 5 if ($data_type ne $key_type)
282 1 4 unless (eval { do { $self->_db_execute($stmt); 1 } })
286 1 4 if ($failed)
287 0 1 if ($one_to_one and do { local $@; eval { do { $e->sql_error } } }) { }
316 2 2 unless (eval { do { $ret = $self->_create_relationships(%args); 1 } })
320 2 2 if ($failed)
339 1 11 unless (eval { do { $ret = $self->_update(%args); 1 } })
343 1 11 if ($failed)
358 8 4 if (%$attributes)
368 7 1 if defined $extra_return
373 3 5 unless ($sth->rows)
387 0 8 if $return == 102 and $update_rel_return != 102
409 4 0 keys %$data ? :
4 6 ref $data eq 'HASH' ? :
10 3 $data ? :
433 0 8 if $insert_return
449 0 4 unless (eval { do { $ret = $self->_update_relationships(%args); 1 } })
453 0 4 if ($failed)
488 0 4 unless (eval { do { $ret = $self->_delete_relationships(%args); 1 } })
492 0 4 if ($failed)
519 0 4 if ($data_type ne $key_type)
548 2 2 unless $rows_modified
576 6 54 if $args{'page'}
592 4 3 if ($offset - $limit >= 0)
597 6 1 if ($rows_fetched >= $limit)
614 0 7 unless exists $page->{'limit'}
616 0 7 unless $page->{'limit'} =~ /\A[0-9]+\z/
619 0 7 unless not exists $page->{'offset'} or $page->{'offset'} =~ /\A[0-9]+\z/
642 0 78 unless $rels
646 24 98 unless @$relationship
651 2 96 if exists $fields->{$rel_type} and not @{$fields->{$rel_type};}
664 16 80 if exists $include{$r}
697 10 0 if ($rel_type and my $rels = $self->_fetchall_relationships(%args))
698 10 0 if exists $rels->{$rel_type}
712 20 68 exists $args{'fields'}{$type} ? :
721 25 132 if keys %type_fields > 0 and not exists $type_fields{$name}
764 0 252 unless $ret
766 3 252 unless (eval { do { $sth = $self->dbh->prepare($stmt->to_sql); $ret = $sth->execute($stmt->to_bind); die $DBI::errstr unless $ret; 1 } })
771 3 252 if ($failed)
776 3 0 if ($sqlite_constraint_failed and $err_id and $err_id == $sqlite_constraint_failed) { }
0 0 elsif ($err_id) { }