1 package PluginTestApp::Controller::Root;
4 use base 'Catalyst::Controller';
8 # +TestApp::Plugin::FullyQualified
11 __PACKAGE__->config->{namespace} = '';
13 sub compile_time_plugins : Local {
14 my ( $self, $c ) = @_;
16 isa_ok $c, 'Catalyst::Plugin::Test::Plugin';
17 isa_ok $c, 'TestApp::Plugin::FullyQualified';
19 can_ok $c, 'registered_plugins';
25 sub run_time_plugins : Local {
26 my ( $self, $c ) = @_;
29 my $faux_plugin = 'Faux::Plugin';
31 # Trick perl into thinking the plugin is already loaded
32 $INC{'Faux/Plugin.pm'} = 1;
34 $c->plugin( faux => $faux_plugin );
36 isa_ok $c, 'Catalyst::Plugin::Test::Plugin';
37 isa_ok $c, 'TestApp::Plugin::FullyQualified';
38 ok !$c->isa($faux_plugin),
39 '... and it should not inherit from the instant plugin';
41 is $c->faux->count, 1, '... and it should behave correctly';
42 is_deeply [ $c->registered_plugins ],
44 qw/Catalyst::Plugin::Test::Plugin
46 TestApp::Plugin::FullyQualified/
48 'registered_plugins() should report all plugins';
49 ok $c->registered_plugins('Faux::Plugin'),
50 '... and even the specific instant plugin';