Articulate/TestEnv.pm

filter: Statementstmt 100% 35 / 35 Branchbran 75.0% 3 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 2 totaltotal 90.5% 48 / 53 SCAR 13.9
CC
4
Cov
95%
app_from_config
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
« Articulate/Authorisation.pm ↑ Summary Articulate/Routes/TransparentForms.pm »
1 package Articulate::TestEnv;
2 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use FindBin;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use YAML;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use Articulate;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use FindBin;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use Exporter::Declare;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 default_exports qw( app_from_config app_from_data );
9  
10 sub app_from_config {
11 3 ▶ my $fn = shift // "$FindBin::Bin/environments/testing.yml";
Subroutine app_from_config: called CC=4 SCAR=13.9
Pod undocumented
Condition50%1/2
shift() // "$FindBin::Bin/environments/testing.yml"
l!l
03
MC/DC0%0/1
shift() // "$FindBin::Bin/environments/testing.yml"
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
12 3 $fn =~ s/(?<!\.yml)$/.yml/g;
13 3 ▶ $fn =~ "$FindBin::Bin/environments/$fn" unless -e $fn;
Branch: 1 branch
BranchTrueFalseTotal
unless -e $fn 0 3 3
14 3 ▶ open my $fh, '<:encoding(utf8)', $fn;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 my $yaml;
16 3 ▶ while (defined ( my $line = <$fh> ) ) { $yaml .= $line };
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = readline $fh)) 327 3 330
17 3 my $data = YAML::Load $yaml;
18 3 return app_from_data( $data->{plugins}->{Articulate} );
19 }
20  
21 sub app_from_data {
22 3 ▶ my $app = Articulate->new( shift );
Subroutine app_from_data: called CC=1 SCAR=0.0
Pod undocumented
23 3 $app->components->{'storage'}->empty_all_content;
24 3 return $app;
25 }
26  
27 4 1;
« Articulate/Authorisation.pm ↑ Summary Articulate/Routes/TransparentForms.pm »