lib/Test2/Harness/UI/Schema/Overlay/Event.pm

filter: Statementstmt 42.6% 26 / 61 Branchbran 4.5% 1 / 22 Conditioncond 0.0% 0 / 17 MC/DCmcdc 0.0% 0 / 11 Subroutinesub 50.0% 6 / 12 Podpod 0.0% 0 / 6 totaltotal 25.5% 33 / 129 CC 18 SCAR 53.6
CC
18
Cov
27%
line_data
342.0
run
2.0
user
2.0
CRAP 212.8
« lib/Test2/Harness/UI/Schema/Overlay/Project.pm ↑ Summary lib/Test2/Harness/UI/Controller/Stream.pm »
1 package Test2::Harness::UI::Schema::Result::Event;
2 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Test2::Harness::UI::Util::ImportModes();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Test2::Formatter::Test2::Composer();
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 ▶use Carp qw/confess/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶confess "You must first load a Test2::Harness::UI::Schema::NAME module"
Branch: 1 branch
BranchTrueFalseTotal
unless $Test2::Harness::UI::Schema::LOADED 0 2 2
11 unless $Test2::Harness::UI::Schema::LOADED;
12  
13 2 our $VERSION = '0.000150';
14  
15 2 __PACKAGE__->parent_column('parent_id');
16  
17 2 __PACKAGE__->inflate_column(
18 facets => {
19 inflate => DBIx::Class::InflateColumn::Serializer::JSON->get_unfreezer('facets', {}),
20 deflate => DBIx::Class::InflateColumn::Serializer::JSON->get_freezer('facets', {}),
21 },
22 );
23  
24 2 __PACKAGE__->inflate_column(
25 orphan => {
26 inflate => DBIx::Class::InflateColumn::Serializer::JSON->get_unfreezer('orphan', {}),
27 deflate => DBIx::Class::InflateColumn::Serializer::JSON->get_freezer('orphan', {}),
28 },
29 );
30  
31 0 ▶sub run { shift->job->run }
Subroutine run: not called CC=1 SCAR=6.9
Pod undocumented
32 0 ▶sub user { shift->job->run->user }
Subroutine user: not called CC=1 SCAR=6.9
Pod undocumented
33  
34 0 ▶sub in_mode {
Subroutine in_mode: not called CC=1 SCAR=6.9
Pod undocumented
35 0 my $self = shift;
36 0 return Test2::Harness::UI::Util::ImportModes::event_in_mode(event => $self, @_);
37 }
38  
39 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=1 SCAR=6.9
Pod undocumented
40 0 my $self = shift;
41 0 my %cols = $self->get_all_fields;
42  
43 # Inflate
44 0 $cols{facets} = $self->facets;
45 0 $cols{orphan} = $self->orphan;
46 0 $cols{lines} = Test2::Formatter::Test2::Composer->render_super_verbose($cols{facets});
47  
48 0 return \%cols;
49 }
50  
51 0 ▶sub st_line_data {
Subroutine st_line_data: not called CC=1 SCAR=6.9
Pod undocumented
52 0 my $self = shift;
53  
54 0 my $out = $self->line_data;
55  
56 0 $out->{loading_subtest} = 1;
57  
58 0 return $out;
59 }
60  
61 0 ▶sub line_data {
Subroutine line_data: not called CC=18 SCAR=58.3
Pod undocumented
62 0 my $self = shift;
63 0 my %cols = $self->get_all_fields;
64 0 my %out;
65  
66 0 ▶ my $has_facets = ($cols{has_facets} || $cols{facets}) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$cols{'has_facets'} || $cols{'facets'} ? : 0 0 0
Condition0%0/3
$cols{"has_facets"} or $cols{"facets"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$cols{"has_facets"} or $cols{"facets"}
$cols{"has_facets"} $cols{"facets"}
Truth table0%0/3
A or B
A= $cols{"has_facets"}B= $cols{"facets"}
ABresult
1X1
011
000
67 0 ▶ my $has_orphan = ($cols{has_orphan} || $cols{orphan}) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$cols{'has_orphan'} || $cols{'orphan'} ? : 0 0 0
Condition0%0/3
$cols{"has_orphan"} or $cols{"orphan"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$cols{"has_orphan"} or $cols{"orphan"}
$cols{"has_orphan"} $cols{"orphan"}
Truth table0%0/3
A or B
A= $cols{"has_orphan"}B= $cols{"orphan"}
ABresult
1X1
011
000
68 0 ▶ my $has_binary = $cols{has_binary} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$cols{'has_binary'} ? : 0 0 0
69  
70 0 ▶ my $facets = $has_facets ? $cols{facets} : undef;
Branch: 1 branch
BranchTrueFalseTotal
$has_facets ? : 0 0 0
71  
72 0 ▶ $out{lines} = Test2::Formatter::Test2::Composer->render_super_verbose($facets // $cols{orphan});
Condition0%0/3
$facets // $cols{"orphan"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$facets // $cols{"orphan"}
$facets $cols{"orphan"}
Truth table0%0/3
A // B
A= $facetsB= $cols{"orphan"}
ABresult
1X1
011
000
73  
74 0 ▶ if ($has_binary) {
Branch: 1 branch
BranchTrueFalseTotal
if ($has_binary) 0 0 0
75 0 for my $binary ($self->binaries) {
76 0 my $filename = $binary->filename;
77  
78 0 ▶ push @{$out{lines}} => [
Branch: 1 branch
BranchTrueFalseTotal
$binary->is_image ? : 0 0 0
79 'binary',
80 $binary->is_image ? 'IMAGE' : 'BINARY',
81 $filename,
82 $binary->binary_id,
83 ];
84 }
85 }
86  
87 0 $out{facets} = $has_facets;
88 0 $out{orphan} = $has_orphan;
89  
90 0 ▶ $out{parent_id} = $cols{parent_id} if $cols{parent_id};
Branch: 1 branch
BranchTrueFalseTotal
if $cols{"parent_id"} 0 0 0
91 0 ▶ $out{nested} = $cols{nested} // 0;
Condition0%0/2
$cols{"nested"} // 0
l!l
00
MC/DC0%0/1
$cols{"nested"} // 0
$cols{"nested"}
Truth table0%0/2
A
A= $cols{"nested"}
Aresult
11
00
92  
93 0 $out{event_id} = $cols{event_id};
94  
95 0 ▶ $out{is_parent} = ($facets && $facets->{parent}) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$facets && $facets->{'parent'} ? : 0 0 0
Condition0%0/3
$facets and $facets->{"parent"}
!ll&&!rl&&r
000
MC/DC0%0/2
$facets and $facets->{"parent"}
$facets $facets->{"parent"}
Truth table0%0/3
A and B
A= $facetsB= $facets->{"parent"}
ABresult
0X0
100
111
96 0 ▶ $out{is_fail} = ($facets && $facets->{assert}) ? $facets->{assert}{pass} ? 0 : 1 : undef;
Branch: 2 branches
BranchTrueFalseTotal
$facets && $facets->{'assert'} ? : 0 0 0
$facets->{'assert'}{'pass'} ? : 0 0 0
Condition0%0/3
$facets and $facets->{"assert"}
!ll&&!rl&&r
000
MC/DC0%0/2
$facets and $facets->{"assert"}
$facets $facets->{"assert"}
Truth table0%0/3
A and B
A= $facetsB= $facets->{"assert"}
ABresult
0X0
100
111
97  
98 0 return \%out;
99 }
100  
101 2 __PACKAGE__->has_many(
102 "events",
103 "Test2::Harness::UI::Schema::Result::Event",
104 {"foreign.parent_id" => "self.event_id"},
105 {cascade_copy => 0, cascade_delete => 0},
106 );
107  
108 2 __PACKAGE__->belongs_to(
109 "parent_rel",
110 "Test2::Harness::UI::Schema::Result::Event",
111 {event_id => "parent_id"},
112 {
113 is_deferrable => 0,
114 join_type => "LEFT",
115 on_delete => "NO ACTION",
116 on_update => "NO ACTION",
117 },
118 );
119  
120 2 1;
121  
122 __END__
« lib/Test2/Harness/UI/Schema/Overlay/Project.pm ↑ Summary lib/Test2/Harness/UI/Controller/Stream.pm »