t/lib/QDB/FakeDriver.pm

filter: Statementstmt 89.6% 26 / 29 Branchbran 50.0% 3 / 6 Conditioncond 40.0% 4 / 10 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 57.1% 8 / 14 Podpod 100% 9 / 9 totaltotal 67.5% 50 / 74 CC 8 SCAR 11.2
CC
8
Cov
73%
start_command
6.9
stop_sig
2.3
fast_stop_sig
2.3
CRAP 3.1
« lib/DBIx/QuickDB/Util/HashBase.pm ↑ Summary blib/lib/DBIx/QuickDB/Driver/Percona.pm »
1 package QDB::FakeDriver;
2 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 6 ▶use parent 'DBIx::QuickDB::Driver';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 6 ▶use DBIx::QuickDB::Util::HashBase qw{
Subroutine BEGIN: called CC=1 SCAR=0.0
8 <exit_code
9 <run_seconds
10 <start_script
11 <shell_script
12 <stop_signal
13 <fast_stop_signal
14 <serve
15 6 };
16  
17 2 ▶sub stop_sig {
Subroutine stop_sig: called CC=2 SCAR=8.1
Pod documented
18 2 my $self = shift;
19 2 ▶ return $self->{+STOP_SIGNAL} // $self->SUPER::stop_sig;
Condition33%1/3
$self->{"stop_signal"} // $self->SUPER::stop_sig
l!l&&r!l&&!r
020
MC/DC0%0/2
$self->{"stop_signal"} // $self->SUPER::stop_sig
$self->{"stop_signal"} $self->SUPER::stop_sig
Truth table33%1/3
A // B
A= $self->{"stop_signal"}B= $self->SUPER::stop_sig
ABresult
1X1
011
000
20 }
21  
22 2 ▶sub fast_stop_sig {
Subroutine fast_stop_sig: called CC=2 SCAR=8.1
Pod documented
23 2 my $self = shift;
24 2 ▶ return $self->{+FAST_STOP_SIGNAL} // $self->SUPER::fast_stop_sig;
Condition33%1/3
$self->{"fast_stop_signal"} // $self->SUPER::fast_stop_sig
l!l&&r!l&&!r
020
MC/DC0%0/2
$self->{"fast_stop_signal"} // $self->SUPER::fast_stop_sig
$self->{"fast_stop_signal"} $self->SUPER::fast_stop_sig
Truth table33%1/3
A // B
A= $self->{"fast_stop_signal"}B= $self->SUPER::fast_stop_sig
ABresult
1X1
011
000
25 }
26  
27 0 ▶sub viable { (1, undef) }
Subroutine viable: not called CC=1 SCAR=6.9
Pod documented
28  
29 # Only created when the server is told to serve; otherwise nothing but the
30 # server exiting can end start()'s wait.
31 6 ▶sub socket {
Subroutine socket: called CC=1 SCAR=0.0
Pod documented
32 6 my $self = shift;
33 6 return $self->{+DIR} . "/fake.sock";
34 }
35  
36 4 ▶sub start_command {
Subroutine start_command: called CC=6 SCAR=19.3
Pod documented
37 4 my $self = shift;
38  
39 4 ▶ return ('/bin/sh', '-c', $self->{+SHELL_SCRIPT}) if defined $self->{+SHELL_SCRIPT};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"shell_script"} 0 4 4
40 4 ▶ return ($^X, '-e', $self->{+START_SCRIPT}) if defined $self->{+START_SCRIPT};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"start_script"} 0 4 4
41  
42 4 ▶ my $code = $self->{+EXIT_CODE} // 0;
Condition50%1/2
$self->{"exit_code"} // 0
l!l
40
MC/DC0%0/1
$self->{"exit_code"} // 0
$self->{"exit_code"}
Truth table50%1/2
A
A= $self->{"exit_code"}
Aresult
11
00
43 4 ▶ my $seconds = $self->{+RUN_SECONDS} // 0;
Condition50%1/2
$self->{"run_seconds"} // 0
l!l
04
MC/DC0%0/1
$self->{"run_seconds"} // 0
$self->{"run_seconds"}
Truth table50%1/2
A
A= $self->{"run_seconds"}
Aresult
11
00
44  
45 # Create the socket so start() succeeds, for tests about teardown rather
46 # than startup.
47 return (
48 $^X, '-MIO::Socket::UNIX', '-e',
49 'IO::Socket::UNIX->new(Local => $ARGV[0], Listen => 1) or die $!; sleep $ARGV[1]; exit $ARGV[2]',
50 $self->socket, $seconds, $code,
51 4 ▶ ) if $self->{+SERVE};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"serve"} 0 4 4
52  
53 4 return ($^X, '-e', "sleep $seconds; exit $code");
54 }
55  
56 0 ▶sub bootstrap { }
Subroutine bootstrap: not called CC=1 SCAR=0.0
57 0 ▶sub write_config { }
Subroutine write_config: not called CC=1 SCAR=0.0
Pod documented
58 0 ▶sub load_sql { }
Subroutine load_sql: not called CC=1 SCAR=0.0
Pod documented
59 0 ▶sub connect_string { 'dbi:FakeDriver:' }
Subroutine connect_string: not called CC=1 SCAR=6.9
Pod documented
60 0 ▶sub shell_command { ($^X, '-e', 'exit 0') }
Subroutine shell_command: not called CC=1 SCAR=6.9
Pod documented
61  
62 6 1;
63  
64 __END__
« lib/DBIx/QuickDB/Util/HashBase.pm ↑ Summary blib/lib/DBIx/QuickDB/Driver/Percona.pm »