6 +TestApp::Plugin::FullyQualified
9 sub compile_time_plugins : Local {
10 my ( $self, $c ) = @_;
12 isa_ok $c, 'Catalyst::Plugin::Test::Plugin';
13 isa_ok $c, 'TestApp::Plugin::FullyQualified';
15 can_ok $c, 'registered_plugins';
21 sub run_time_plugins : Local {
22 my ( $self, $c ) = @_;
25 my $faux_plugin = 'Faux::Plugin';
27 # Trick perl into thinking the plugin is already loaded
28 $INC{'Faux/Plugin.pm'} = 1;
30 __PACKAGE__->plugin( faux => $faux_plugin );
32 isa_ok $c, 'Catalyst::Plugin::Test::Plugin';
33 isa_ok $c, 'TestApp::Plugin::FullyQualified';
34 ok !$c->isa($faux_plugin),
35 '... and it should not inherit from the instant plugin';
37 is $c->faux->count, 1, '... and it should behave correctly';
38 is_deeply [ $c->registered_plugins ],
40 qw/Catalyst::Plugin::Test::Plugin
42 TestApp::Plugin::FullyQualified/
44 'registered_plugins() should report all plugins';
45 ok $c->registered_plugins('Faux::Plugin'),
46 '... and even the specific instant plugin';
53 is_deeply [ $c->registered_plugins ],
55 qw/Catalyst::Plugin::Test::Plugin
56 TestApp::Plugin::FullyQualified/
58 '... and it should report the correct plugins';
59 ok $c->registered_plugins('Catalyst::Plugin::Test::Plugin'),
60 '... or if we have a particular plugin';
61 ok $c->registered_plugins('Test::Plugin'),
62 '... even if it is not fully qualified';
63 ok !$c->registered_plugins('No::Such::Plugin'),
64 '... and it should return false if the plugin does not exist';