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