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 ref($c)->plugin( faux => $faux_plugin );
36 isa_ok $c, 'Catalyst::Plugin::Test::Plugin';
38 # applied parameterized role
39 if (eval { require MooseX::Role::Parameterized; 1 }) {
41 is $c->affe, 'birne', 'right method created by parameterized role';
44 isa_ok $c, 'TestApp::Plugin::FullyQualified';
45 ok !$c->isa($faux_plugin),
46 '... and it should not inherit from the instant plugin';
48 is $c->faux->count, 1, '... and it should behave correctly';
49 is_deeply [ $c->registered_plugins ],
51 qw/Catalyst::Plugin::Test::Plugin
53 TestApp::Plugin::FullyQualified/
55 'registered_plugins() should report all plugins';
56 ok $c->registered_plugins('Faux::Plugin'),
57 '... and even the specific instant plugin';