stop using Moo as a test package
[catagits/Catalyst-Runtime.git] / t / lib / TestFromPSGI / Controller / Root.pm
1 package TestFromPSGI::Controller::Root;
2
3 use Moose;
4 use MooseX::MethodAttributes;
5
6 extends 'Catalyst::Controller';
7
8 sub test_psgi_keys :Local {
9   my ($self, $c) = @_;
10   $c->res->body('ok');
11 }
12
13 sub from_psgi_array : Local {
14   my ($self, $c) = @_;
15   my $res = sub {
16     my ($env) = @_;
17     return [200, ['Content-Type'=>'text/plain'],
18       [qw/hello world today/]];
19   }->($c->req->env);
20
21   $c->res->from_psgi_response($res);
22 }
23
24 sub from_psgi_code : Local {
25   my ($self, $c) = @_;
26
27   my $res = sub {
28     my ($env) = @_;
29     return sub {
30       my $responder = shift;
31       return $responder->([200, ['Content-Type'=>'text/plain'],
32         [qw/hello world today2/]]);
33     };
34   }->($c->req->env);
35
36   $c->res->from_psgi_response($res);
37 }
38
39 sub from_psgi_code_itr : Local {
40   my ($self, $c) = @_;
41   my $res = sub {
42     my ($env) = @_;
43     return sub {
44       my $responder = shift;
45       my $writer = $responder->([200, ['Content-Type'=>'text/plain']]);
46       $writer->write('hello');
47       $writer->write('world');
48       $writer->write('today3');
49       $writer->close;
50     };
51   }->($c->req->env);
52
53   $c->res->from_psgi_response($res);
54 }
55
56 __PACKAGE__->meta->make_immutable;