Branch Coverage

blib/lib/Test/PONAPI/Repository/MockDB.pm
Criterion Covered Total %
branch 90 120 75.0


line true false branch
43 13 0 unless $params->{'skip_data_load'}
54 117 0 if (my $table = $self->tables->{$type})
63 160 0 if (my $table = $self->tables->{$type})
65 0 160 unless exists $relations->{$rel_name}
78 46 10 unless grep((!exists $columns{$_}), @$fields)
86 5 49 if $args{'page'}
103 1 3 if $page
106 1 3 if (@$sort)
107 0 1 if @$sort > 1 or not $sort->[0] =~ /\A(-)?id\z/
117 1 0 $desc ? :
126 0 4 unless $rels
0 4 unless @{[] unless $rels;}
130 1 3 if $page
143 1 5 if $page
154 0 6 unless @$rels
188 2 3 unless (eval { do { $self->_create(%args); 1 } })
192 2 3 if ($failed)
221 2 0 if ref $rel_data ne 'ARRAY'
255 2 5 if ($data_type ne $key_type)
280 1 4 unless (eval { do { $self->_db_execute($stmt); 1 } })
284 1 4 if ($failed)
285 0 1 if ($one_to_one and do { local $@; eval { do { $e->sql_error } } }) { }
314 2 2 unless (eval { do { $ret = $self->_create_relationships(%args); 1 } })
318 2 2 if ($failed)
337 1 11 unless (eval { do { $ret = $self->_update(%args); 1 } })
341 1 11 if ($failed)
356 8 4 if (%$attributes)
366 7 1 if defined $extra_return
371 3 5 unless ($sth->rows)
385 0 8 if $return == 102 and $update_rel_return != 102
407 4 0 keys %$data ? :
4 6 ref $data eq 'HASH' ? :
10 3 $data ? :
431 0 8 if $insert_return
447 0 4 unless (eval { do { $ret = $self->_update_relationships(%args); 1 } })
451 0 4 if ($failed)
486 0 4 unless (eval { do { $ret = $self->_delete_relationships(%args); 1 } })
490 0 4 if ($failed)
517 0 4 if ($data_type ne $key_type)
546 2 2 unless $rows_modified
574 6 54 if $args{'page'}
590 4 3 if ($offset - $limit >= 0)
595 6 1 if ($rows_fetched >= $limit)
612 0 7 unless exists $page->{'limit'}
614 0 7 unless $page->{'limit'} =~ /\A[0-9]+\z/
617 0 7 unless not exists $page->{'offset'} or $page->{'offset'} =~ /\A[0-9]+\z/
640 0 78 unless $rels
644 24 98 unless @$relationship
649 2 96 if exists $fields->{$rel_type} and not @{$fields->{$rel_type};}
662 16 80 if exists $include{$r}
695 10 0 if ($rel_type and my $rels = $self->_fetchall_relationships(%args))
696 10 0 if exists $rels->{$rel_type}
710 20 68 exists $args{'fields'}{$type} ? :
719 25 132 if keys %type_fields > 0 and not exists $type_fields{$name}
759 0 255 unless $stmt->{'bind'}
762 0 252 unless $ret
764 3 252 unless (eval { do { $sth = $self->dbh->prepare($stmt->{'sql'}); $ret = $sth->execute(@{[] unless $stmt->{'bind'};}); die $DBI::errstr unless $ret; 1 } })
769 3 252 if ($failed)
774 3 0 if ($sqlite_constraint_failed and $err_id and $err_id == $sqlite_constraint_failed) { }
0 0 elsif ($err_id) { }