lib/Reaction/Test.pm

filter: Statementstmt 39.0% 16 / 41 Branchbran 12.5% 1 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 18.1% 4 / 22 Podpod 0.0% 0 / 1 totaltotal 29.1% 21 / 72 CC 5 SCAR 9.9
CC
5
Cov
35%
__ANON__
6.0
__ANON__
6.0
__ANON__
4.3
CRAP 2.7
« lib/Catalyst/Model/Reaction/InterfaceModel/DBIC.pm ↑ Summary lib/Reaction/UI/ViewPort/Field/Mutable/DateTime.pm »
1 package Reaction::Test;
2  
3 4 ▶use base qw/Test::Class Reaction::Object/;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use Reaction::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶sub simple_mock_context {
Subroutine simple_mock_context: called CC=1 SCAR=3.4
Pod undocumented
7 3 my ($q_p, $b_p, $path) = ({}, {}, 'test/path');
8 my $req = bless({
9 0 ▶ query_parameters => sub { $q_p }, body_parameters => sub { $b_p },
Subroutine __ANON__: not called CC=1 SCAR=6.9
Subroutine __ANON__: not called CC=1 SCAR=6.9
10 0 ▶ path => sub { shift; $path = shift if @_; $path; },
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
11 3 }, 'Reaction::Test::Mock::Request');
12 3 my %res_info = (content_type => '', body => '', status => 200, headers => {});
13 my $res = bless({
14 (map {
15 12 my $key = $_;
16 0 ▶ ($key => sub { shift; $res_info{$key} = shift if @_; $res_info{$key} });
Subroutine __ANON__: not called CC=2 SCAR=14.6
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
17 } keys %res_info),
18 0 ▶ header => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
19 0 shift; my $h = shift;
20 0 ▶ $res_info{headers}{$h} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
21 0 $res_info{headers}{$h};
22 },
23 3 }, 'Reaction::Test::Mock::Response');
24 return bless({
25 0 ▶ req => sub { $req }, res => sub { $res },
Subroutine __ANON__: not called CC=1 SCAR=6.9
Subroutine __ANON__: not called CC=1 SCAR=6.9
26 3 }, 'Reaction::Test::Mock::Context');
27 }
28
29 =head1 NAME
30  
31 Reaction::Test
32  
33 =head1 DESCRIPTION
34  
35 =head1 AUTHORS
36  
37 See L<Reaction::Class> for authors.
38  
39 =head1 LICENSE
40  
41 See L<Reaction::Class> for the license.
42  
43 =cut
44  
45  
46 package Reaction::Test::Mock::Context;
47  
48 12 ▶sub isa {
Subroutine isa: called CC=2 SCAR=7.2
49 12 ▶ shift; return 1 if (shift eq 'Catalyst');
Branch: 1 branch
BranchTrueFalseTotal
if shift() eq "Catalyst" 12 0 12
50 }
51  
52 0 ▶sub view {
Subroutine view: not called CC=1 SCAR=6.9
53 0 return $_[0]->{view}->(@_);
54 }
55  
56 0 ▶sub req {
Subroutine req: not called CC=1 SCAR=6.9
57 0 return $_[0]->{req}->(@_);
58 }
59  
60 0 ▶sub res {
Subroutine res: not called CC=1 SCAR=6.9
61 0 return $_[0]->{res}->(@_);
62 }
63  
64 package Reaction::Test::Mock::Request;
65  
66 0 ▶sub query_parameters {
Subroutine query_parameters: not called CC=1 SCAR=6.9
67 0 return $_[0]->{query_parameters}->(@_);
68 }
69  
70 0 ▶sub body_parameters {
Subroutine body_parameters: not called CC=1 SCAR=6.9
71 0 return $_[0]->{body_parameters}->(@_);
72 }
73  
74 0 ▶sub path {
Subroutine path: not called CC=1 SCAR=6.9
75 0 return $_[0]->{path}->(@_);
76 }
77  
78 package Reaction::Test::Mock::Response;
79  
80 0 ▶sub body {
Subroutine body: not called CC=1 SCAR=6.9
81 0 return $_[0]->{body}->(@_);
82 }
83  
84 0 ▶sub content_type {
Subroutine content_type: not called CC=1 SCAR=6.9
85 0 return $_[0]->{content_type}->(@_);
86 }
87  
88 0 ▶sub status {
Subroutine status: not called CC=1 SCAR=6.9
89 0 return $_[0]->{status}->(@_);
90 }
91  
92 0 ▶sub headers {
Subroutine headers: not called CC=1 SCAR=6.9
93 0 return $_[0]->{headers}->(@_);
94 }
95  
96 0 ▶sub header {
Subroutine header: not called CC=1 SCAR=6.9
97 0 return $_[0]->{header}->(@_);
98 }
99  
100 4 1;
« lib/Catalyst/Model/Reaction/InterfaceModel/DBIC.pm ↑ Summary lib/Reaction/UI/ViewPort/Field/Mutable/DateTime.pm »