Tapper/Schema/TestrunDB/Result/ReportFile.pm

filter: Statementstmt 92.5% 37 / 40 Branchbran 62.5% 5 / 8 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 78.1% 50 / 64 CC 7 SCAR 12.1
CC
7
Cov
81%
__ANON__
4.7
__ANON__
4.3
BEGIN
1.0
CRAP 3.3
« Tapper/Schema/TestrunDB/ResultSet/TestrunScheduling.pm ↑ Summary Tapper/Schema/TestrunDB/ResultSet/Testrun.pm »
1 package Tapper::Schema::TestrunDB::Result::ReportFile;
2 10 our $AUTHORITY = 'cpan:TAPPER';
3 10 $Tapper::Schema::TestrunDB::Result::ReportFile::VERSION = '5.0.12';
4 # ABSTRACT: Tapper - Containg files attached to reports
5  
6 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 10 ▶use parent 'DBIx::Class';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 10 ▶use Compress::Bzip2;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 10 __PACKAGE__->load_components(qw/FilterColumn InflateColumn::DateTime TimeStamp Core/);
13 10 __PACKAGE__->table("reportfile");
14 10 __PACKAGE__->add_columns
15 (
16 "id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 11, is_auto_increment => 1, },
17 "report_id", { data_type => "INT", default_value => undef, is_nullable => 0, size => 11, is_foreign_key => 1, },
18 "filename", { data_type => "VARCHAR", default_value => "", is_nullable => 1, size => 255, },
19 "contenttype", { data_type => "VARCHAR", default_value => "", is_nullable => 1, size => 255, },
20 "filecontent", { data_type => "LONGBLOB", default_value => "", is_nullable => 0, },
21 "is_compressed", { data_type => "INT", default_value => 0, is_nullable => 0, },
22 "created_at", { data_type => "DATETIME", default_value => undef, is_nullable => 0, set_on_create => 1, },
23 "updated_at", { data_type => "DATETIME", default_value => undef, is_nullable => 0, set_on_create => 1, set_on_update => 1, },
24 );
25  
26 10 __PACKAGE__->set_primary_key("id");
27 __PACKAGE__->filter_column('filecontent', {
28 1 ▶ filter_from_storage => sub { my ($row, $element) = @_;
Subroutine __ANON__: called CC=4 SCAR=15.5
29 1 my $uncompressed;
30 1 ▶ if ($row->is_compressed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($row->is_compressed) 1 0 1
31 1 eval { $uncompressed = memBunzip( $element ) };
32 1 ▶ return $uncompressed if !$@ && $uncompressed;
Branch: 1 branch
BranchTrueFalseTotal
if not $@ and $uncompressed 1 0 1
Condition33%1/3
not $@ and $uncompressed
!ll&&!rl&&r
001
MC/DC0%0/2
not $@ and $uncompressed
not $@ $uncompressed
Truth table33%1/3
not(A) and B
A= not $@B= $uncompressed
ABresult
0X0
100
111
33 }
34 0 return $element;
35 },
36 2 ▶ filter_to_storage => sub { my ($row, $element) = @_;
Subroutine __ANON__: called CC=4 SCAR=14.6
37 2 ▶ if ($element) {
Branch: 1 branch
BranchTrueFalseTotal
if ($element) { } 1 1 2
38 1 my $compressed;
39 1 eval {
40 1 $compressed = memBzip( $element );
41 };
42 1 ▶ if (!$@ and $compressed) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $@ and $compressed) { } 1 0 1
Condition33%1/3
not $@ and $compressed
!ll&&!rl&&r
001
MC/DC0%0/2
not $@ and $compressed
not $@ $compressed
Truth table33%1/3
not(A) and B
A= not $@B= $compressed
ABresult
0X0
100
111
43 1 $row->is_compressed( 1 );
44 1 return $compressed;
45 } else {
46 0 $row->is_compressed( 0 );
47 0 return $element;
48 }
49 } else {
50 1 $row->is_compressed( 0 );
51 1 return $element;
52 }
53 },
54 }
55 10 );
56 10 __PACKAGE__->belongs_to ( report => 'Tapper::Schema::TestrunDB::Result::Report', { 'foreign.id' => 'self.report_id' });
57  
58 10 1;
59  
60 __END__
« Tapper/Schema/TestrunDB/ResultSet/TestrunScheduling.pm ↑ Summary Tapper/Schema/TestrunDB/ResultSet/Testrun.pm »