minor documentation fix for handle_request
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_core_plugin.t
CommitLineData
836e1134 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
d6ce7d52 6use Test::More tests => 24;
836e1134 7
8use lib 't/lib';
9
10{
11
12 package Faux::Plugin;
13
06400669 14 sub new { bless { count => 1 }, shift }
15 sub count { shift->{count}++ }
836e1134 16}
17
d6ce7d52 18my $warnings = 0;
19
20use PluginTestApp;
7e114dd4 21my $logger = Class::MOP::Class->create_anon_class(
22 methods => {
6b4ae531 23 error => sub {0},
24 debug => sub {0},
25 info => sub {0},
7e114dd4 26 warn => sub {
27 if ($_[1] =~ /plugin method is deprecated/) {
28 $warnings++;
29 return;
30 }
31 die "Caught unexpected warning: " . $_[1];
32 },
33 },
34)->new_object;
35PluginTestApp->log($logger);
d6ce7d52 36
836e1134 37use Catalyst::Test qw/PluginTestApp/;
38
39ok( get("/compile_time_plugins"), "get ok" );
d6ce7d52 40is( $warnings, 0, 'no warnings' );
6b2a933b 41# FIXME - Run time plugin support is insane, and should be removed
42# for Catalyst 5.9
836e1134 43ok( get("/run_time_plugins"), "get ok" );
d0d4d785 44
6b4ae531 45local $ENV{CATALYST_DEBUG} = 0;
46
d6ce7d52 47is( $warnings, 1, '1 warning' );
48
d0d4d785 49use_ok 'TestApp';
50my @expected = qw(
51 Catalyst::Plugin::Test::Errors
52 Catalyst::Plugin::Test::Headers
d13a7137 53 Catalyst::Plugin::Test::Inline
3d101ef9 54 Catalyst::Plugin::Test::MangleDollarUnderScore
d0d4d785 55 Catalyst::Plugin::Test::Plugin
79d000eb 56 TestApp::Plugin::AddDispatchTypes
d0d4d785 57 TestApp::Plugin::FullyQualified
58);
59
60# Faux::Plugin is no longer reported
61is_deeply [ TestApp->registered_plugins ], \@expected,
62 'registered_plugins() should only report the plugins for the current class';
6b4ae531 63