4 Test::MangleDollarUnderScore
9 +TestApp::Plugin::FullyQualified
10 +TestApp::Plugin::AddDispatchTypes
16 use namespace::autoclean;
19 # t/aggregate/unit_core_ctx_attr.t pukes until lazy is true
22 sub hello_notlazy { 'hello there' }
23 sub hello_lazy { 'hello there' }
26 has 'my_greeting_obj_notlazy' => (
29 default => sub { Greeting->new() },
30 handles => [ qw( hello_notlazy ) ],
33 has 'my_greeting_obj_lazy' => (
36 default => sub { Greeting->new() },
37 handles => [ qw( hello_lazy ) ],
42 our $VERSION = '0.01';
47 use_request_uri_for_path => 1,
48 'Controller::Action::Action' => {
50 action_action_nine => { another_extra_arg => 13 }
55 # Test bug found when re-adjusting the metaclass compat code in Moose
56 # in 292360. Test added to Moose in 4b760d6, but leave this attribute
57 # above ->setup so we have some generated methods to be double sure.
58 has an_attribute_before_we_change_base_classes => ( is => 'ro');
60 if ($::setup_leakchecker && eval { Class::MOP::load_class('CatalystX::LeakChecker'); 1 }) {
61 with 'CatalystX::LeakChecker';
65 default => sub { [] },
70 my ($ctx, @leaks) = @_;
71 push @{ $ctx->leaks }, @leaks;
76 return scalar @{ $ctx->leaks };
83 my $class = ref( $c->component( $_[0] ) ) || $_[0];
84 my $action = $_[1]->reverse;
88 if ( $action =~ /->(\w+)$/ ) {
91 elsif ( $action =~ /\/(\w+)$/ ) {
94 elsif ( $action =~ /^(\w+)$/ ) {
98 if ( $class && $method && $method !~ /^_/ ) {
99 my $executed = sprintf( "%s->%s", $class, $method );
100 my @executed = $c->response->headers->header('X-Catalyst-Executed');
101 push @executed, $executed;
102 $c->response->headers->header(
103 'X-Catalyst-Executed' => join ', ',
107 no warnings 'recursion';
108 return $c->SUPER::execute(@_);
111 # Replace the very large HTML error page with
112 # useful info if something crashes during a test
116 $c->next::method(@_);
118 $c->res->status(500);
119 $c->res->body( 'FATAL ERROR: ' . join( ', ', @{ $c->error } ) );
123 no warnings 'redefine';
124 sub Catalyst::Log::error { }
127 # Pretend to be Plugin::Session and hook finalize_headers to send a header
129 sub finalize_headers {
132 $c->res->header('X-Test-Header', 'valid');
134 my $call_count = $c->stash->{finalize_headers_call_count} || 0;
136 $c->stash(finalize_headers_call_count => $call_count);
137 $c->res->header('X-Test-Header-Call-Count' => $call_count);
139 return $c->maybe::next::method(@_);
142 # Make sure we can load Inline plugins.
144 package Catalyst::Plugin::Test::Inline;
148 use base qw/Class::Data::Inheritable/;