Branch Coverage

inc/DBD/Mock.pm
Criterion Covered Total %
branch 17 316 5.3


line true false branch
5 0 0 if @_ and lc $_[0] eq 'pool'
30 0 1 if defined $drh
32 0 1 unless defined $attributes and ref $attributes eq 'HASH'
76 0 0 unless exists $AttributeAliases{lc $dbname}
104 0 1 if ($$drh{'mock_connect_fail'} == 1)
110 0 0 if ($dbname and $DBD::Mock::AttributeAliasing)
135 0 0 if ($attr =~ /^mock_/) { }
136 0 0 if ($attr eq 'mock_connect_fail') { }
0 0 elsif ($attr eq 'mock_data_sources') { }
140 0 0 unless (defined $$drh{'mock_data_sources'})
156 0 0 if ($attr =~ /^mock_/) { }
157 0 0 if ($attr eq 'mock_connect_fail') { }
0 0 elsif ($attr eq 'mock_data_sources') { }
0 0 elsif ($attr eq 'mock_add_data_sources') { }
158 0 0 $value ? :
161 0 0 if (ref $value ne 'ARRAY')
178 0 0 /^DBI\:Mock\:/i ? :
220 0 0 unless ($$dbh{'mock_can_connect'})
224 0 0 unless ($$dbh{'mock_can_prepare'})
228 0 0 if $$dbh{'mock_can_prepare'} < 0
233 0 0 if (ref $parser eq 'CODE') { }
241 0 0 if ($@)
248 0 0 if (my $session = $dbh->FETCH('mock_session'))
252 0 0 if ($@)
269 0 0 if (my $all_rs = $$dbh{'mock_rs'})
270 0 0 if (my $by_name = $$all_rs{'named'}{$statement}) { }
273 0 0 if (exists $$by_name{'failure'})
282 0 0 if (ref $rs eq 'ARRAY' and scalar @{$rs;} > 0) { }
296 0 0 unless ($dbh->FETCH('Active'))
322 0 0 if ($dbh->FETCH('AutoCommit')) { }
337 0 0 if ($dbh->FETCH('AutoCommit') and $dbh->FETCH('Warn'))
345 0 0 if ($begin_work_commit)
355 0 0 if ($dbh->FETCH('AutoCommit') and $dbh->FETCH('Warn'))
363 0 0 if ($begin_work_commit)
389 0 0 unless defined $a_ref or ref $a_ref ne 'ARRAY'
392 0 0 if (ref $$attrib{'Columns'} eq 'ARRAY')
405 0 0 if ($attrib eq 'Active') { }
0 0 elsif ($attrib eq 'mock_all_history') { }
0 0 elsif ($attrib eq 'mock_all_history_iterator') { }
0 0 elsif ($attrib =~ /^mock/) { }
0 0 elsif ($attrib =~ /^(private_|dbi_|dbd_|[A-Z])/) { }
422 0 0 if ($$dbh{'mock_attribute_aliases'})
423 0 0 if (exists ${$$dbh{'mock_attribute_aliases'}{'db'};}{$attrib})
425 0 0 if (ref $mock_attrib eq 'CODE') { }
440 10 0 defined $value ? :
442 1 9 if ($attrib eq 'AutoCommit')
445 1 0 $value ? :
448 0 10 if ($attrib eq 'mock_clear_history') { }
0 10 elsif ($attrib eq 'mock_add_parser') { }
0 10 elsif ($attrib eq 'mock_add_resultset') { }
0 10 elsif ($attrib eq 'mock_start_insert_id') { }
0 10 elsif ($attrib eq 'mock_session') { }
0 10 elsif ($attrib =~ /^mock_(add_)?data_sources/) { }
6 4 elsif ($attrib =~ /^mock/) { }
4 0 elsif ($attrib =~ /^(private_|dbi_|dbd_|[A-Z])/) { }
449 0 0 if ($value)
458 0 0 if ($parser_type eq 'CODE') { }
0 0 elsif ($parser_type and not $parser_type =~ /^(ARRAY|HASH|SCALAR)$/) { }
465 0 0 unless ($is_valid_parser)
477 0 0 if (ref $value eq 'ARRAY') { }
0 0 elsif (ref $value eq 'HASH') { }
484 0 0 unless ($name)
492 0 0 if (exists $$value{'failure'})
505 0 0 if (ref $value eq 'ARRAY') { }
506 0 0 unless $$dbh{'mock_last_insert_ids'}
517 0 0 if defined $value
540 0 1 if (my $session = $$dbh{'mock_session'})
541 0 0 if ($session->has_states_left)
549 0 0 if (my $session = $$dbh{'mock_session'})
550 0 0 if ($session->has_states_left)
585 0 0 unless UNIVERSAL::isa($val, 'SCALAR')
588 0 0 unless $max_len > 0
599 0 0 unless ($$dbh{'mock_can_connect'})
603 0 0 unless ($$dbh{'mock_can_execute'})
607 0 0 if $$dbh{'mock_can_execute'} < 0
611 0 0 if ($tracker->has_failure)
616 0 0 if (@params)
620 0 0 if (my $session = $$dbh{'mock_session'})
628 0 0 if ($@)
644 0 0 if ($$dbh{'Statement'} =~ /^\s*?insert\s+into\s+(\S+)/i)
645 0 0 if ($$dbh{'mock_last_insert_ids'} and exists $$dbh{'mock_last_insert_ids'}{$1}) { }
655 0 0 if ($$dbh{'Statement'} =~ /^\s*?select/i)
664 0 0 unless ($$dbh{'mock_can_connect'})
668 0 0 unless ($$dbh{'mock_can_fetch'})
672 0 0 if $$dbh{'mock_can_fetch'} < 0
676 0 0 unless my $record = $tracker->next_record
679 0 0 if (my(@cols) = $tracker->bind_cols)
691 0 0 unless ref $row eq 'ARRAY'
705 0 0 unless ($$dbh{'mock_can_connect'})
709 0 0 unless ($$dbh{'mock_can_fetch'})
713 0 0 if $$dbh{'mock_can_fetch'} < 0
723 0 0 if (my $record = $tracker->next_record)
741 0 0 unless ($$dbh{'mock_can_connect'})
745 0 0 unless ($$dbh{'mock_can_fetch'})
749 0 0 if $$dbh{'mock_can_fetch'} < 0
759 0 0 unless ($keyfield =~ /^-?\d+$/)
763 0 0 if ($$fields[$index] eq $keyfield)
771 0 0 unless ($found)
809 0 0 if ($attrib eq 'NAME') { }
0 0 elsif ($attrib eq 'NAME_lc') { }
0 0 elsif ($attrib eq 'NAME_uc') { }
0 0 elsif ($attrib eq 'NAME_hash') { }
0 0 elsif ($attrib eq 'NAME_hash_lc') { }
0 0 elsif ($attrib eq 'NAME_hash_uc') { }
0 0 elsif ($attrib eq 'NUM_OF_FIELDS') { }
0 0 elsif ($attrib eq 'NUM_OF_PARAMS') { }
0 0 elsif ($attrib eq 'TYPE') { }
0 0 elsif ($attrib eq 'Active') { }
0 0 elsif (not $attrib =~ /^mock/) { }
846 0 0 if ($$sth{'Database'}{'mock_attribute_aliases'})
847 0 0 if (exists ${$$sth{'Database'}{'mock_attribute_aliases'}{'st'};}{$attrib})
849 0 0 if (ref $mock_attrib eq 'CODE') { }
862 0 0 if ($attrib eq 'mock_my_history')
865 0 0 if ($attrib eq 'mock_statement') { }
0 0 elsif ($attrib eq 'mock_params') { }
0 0 elsif ($attrib eq 'mock_records') { }
0 0 elsif ($attrib eq 'mock_num_records' or $attrib eq 'mock_num_rows') { }
0 0 elsif ($attrib eq 'mock_current_record_num') { }
0 0 elsif ($attrib eq 'mock_fields') { }
0 0 elsif ($attrib eq 'mock_is_executed') { }
0 0 elsif ($attrib eq 'mock_is_finished') { }
0 0 elsif ($attrib eq 'mock_is_depleted') { }
900 0 0 if ($attrib =~ /^mock/) { }
0 0 elsif ($attrib =~ /^NAME/) { }
928 0 0 if $connection
932 0 0 unless ref $_[0]
983 0 0 $$self{'failure'} ? :
1024 0 0 unless $$self{'bind_cols'}
1037 0 0 unless $self->statement =~ /^\s*select/ism
1038 0 0 unless $self->is_executed eq 'yes'
1039 0 0 if $self->is_depleted
1045 0 0 if (defined $value and $value eq 'yes') { }
0 0 elsif (defined $value) { }
1067 0 0 if $self->is_depleted
1097 0 0 if defined $yes_no
1098 0 0 $$self{'is_executed'} eq 'yes' ? :
1105 0 0 if defined $value
1111 0 0 if defined $value
1119 0 0 if scalar @values
1125 0 0 if scalar @values
1131 0 0 if scalar @values
1151 0 0 unless $$self{'pointer'} < scalar @{$$self{'history'};}
1167 0 0 unless @_
1169 0 0 if (ref $_[0]) { }
1176 0 0 unless @session_states
1202 0 0 unless $self->has_states_left
1206 0 0 unless exists ${$current_state;}{'statement'} and exists ${$current_state;}{'results'}
1210 0 0 if (not ref $SQL) { }
0 0 elsif (ref $SQL eq 'Regexp') { }
0 0 elsif (ref $SQL eq 'CODE') { }
1211 0 0 unless $SQL eq $statement
1217 0 0 unless $statement =~ /$SQL/
1223 0 0 unless &$SQL($statement, $current_state)
1237 0 0 if (exists ${$current_state;}{'bound_params'})
1242 0 0 unless scalar @{$expected;} == scalar @{$params;}
1245 0 0 if (ref $$expected[$i] eq 'Regexp') { }
1246 0 0 unless $$params[$i] =~ /$$expected[$i]/
1252 0 0 unless $$params[$i] eq $$expected[$i]