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