4 Test::MangleDollarUnderScore
9 +TestApp::Plugin::FullyQualified
10 +TestApp::Plugin::AddDispatchTypes
14 use Class::Load 'try_load_class';
17 use namespace::clean -except => [ 'meta' ];
20 # t/aggregate/unit_core_ctx_attr.t pukes until lazy is true
23 sub hello_notlazy { 'hello there' }
24 sub hello_lazy { 'hello there' }
27 has 'my_greeting_obj_notlazy' => (
30 default => sub { Greeting->new() },
31 handles => [ qw( hello_notlazy ) ],
34 has 'my_greeting_obj_lazy' => (
37 default => sub { Greeting->new() },
38 handles => [ qw( hello_lazy ) ],
43 our $VERSION = '0.01';
48 use_request_uri_for_path => 1,
49 'Controller::Action::Action' => {
51 action_action_nine => { another_extra_arg => 13 }
55 abort_chain_on_error_fix => 1,
58 # Test bug found when re-adjusting the metaclass compat code in Moose
59 # in 292360. Test added to Moose in 4b760d6, but leave this attribute
60 # above ->setup so we have some generated methods to be double sure.
61 has an_attribute_before_we_change_base_classes => ( is => 'ro');
63 if ($::setup_leakchecker && try_load_class('CatalystX::LeakChecker')) {
64 with 'CatalystX::LeakChecker';
68 default => sub { [] },
73 my ($ctx, @leaks) = @_;
74 push @{ $ctx->leaks }, @leaks;
79 return scalar @{ $ctx->leaks };
86 my $class = ref( $c->component( $_[0] ) ) || $_[0];
87 my $action = $_[1]->reverse;
91 if ( $action =~ /->(\w+)$/ ) {
94 elsif ( $action =~ /\/(\w+)$/ ) {
97 elsif ( $action =~ /^(\w+)$/ ) {
101 if ( $class && $method && $method !~ /^_/ ) {
102 my $executed = sprintf( "%s->%s", $class, $method );
103 my @executed = $c->response->headers->header('X-Catalyst-Executed');
104 push @executed, $executed;
105 $c->response->headers->header(
106 'X-Catalyst-Executed' => join ', ',
110 no warnings 'recursion';
111 return $c->SUPER::execute(@_);
114 # Replace the very large HTML error page with
115 # useful info if something crashes during a test
119 $c->next::method(@_);
121 $c->res->status(500);
122 $c->res->body( 'FATAL ERROR: ' . join( ', ', @{ $c->error } ) );
126 no warnings 'redefine';
127 sub Catalyst::Log::error { }
130 # Pretend to be Plugin::Session and hook finalize_headers to send a header
132 sub finalize_headers {
135 $c->res->header('X-Test-Header', 'valid');
137 my $call_count = $c->stash->{finalize_headers_call_count} || 0;
139 $c->stash(finalize_headers_call_count => $call_count);
140 $c->res->header('X-Test-Header-Call-Count' => $call_count);
142 return $c->maybe::next::method(@_);
145 # Make sure we can load Inline plugins.
147 package Catalyst::Plugin::Test::Inline;