1 package Reaction::Test;
3 use base qw/Test::Class Reaction::Object/;
6 sub simple_mock_context {
7 my ($q_p, $b_p, $path) = ({}, {}, 'test/path');
9 query_parameters => sub { $q_p }, body_parameters => sub { $b_p },
10 path => sub { shift; $path = shift if @_; $path; },
11 }, 'Reaction::Test::Mock::Request');
12 my %res_info = (content_type => '', body => '', status => 200, headers => {});
16 ($key => sub { shift; $res_info{$key} = shift if @_; $res_info{$key} });
20 $res_info{headers}{$h} = shift if @_;
21 $res_info{headers}{$h};
23 }, 'Reaction::Test::Mock::Response');
25 req => sub { $req }, res => sub { $res },
26 }, 'Reaction::Test::Mock::Context');
37 See L<Reaction::Class> for authors.
41 See L<Reaction::Class> for the license.
46 package Reaction::Test::Mock::Context;
49 shift; return 1 if (shift eq 'Catalyst');
53 return $_[0]->{view}->(@_);
57 return $_[0]->{req}->(@_);
61 return $_[0]->{res}->(@_);
64 package Reaction::Test::Mock::Request;
66 sub query_parameters {
67 return $_[0]->{query_parameters}->(@_);
71 return $_[0]->{body_parameters}->(@_);
75 return $_[0]->{path}->(@_);
78 package Reaction::Test::Mock::Response;
81 return $_[0]->{body}->(@_);
85 return $_[0]->{content_type}->(@_);
89 return $_[0]->{status}->(@_);
93 return $_[0]->{headers}->(@_);
97 return $_[0]->{header}->(@_);