Test and Changelog entry for r10961.
[catagits/Catalyst-Runtime.git] / t / unit_core_component_loading.t
index 6b9f8da..42f1eac 100644 (file)
@@ -1,7 +1,8 @@
 # 2 initial tests, and 6 per component in the loop below
 # (do not forget to update the number of components in test 3 as well)
 # 5 extra tests for the loading options
-use Test::More tests => 2 + 6 * 24 + 5;
+# One test for components in inner packages
+use Test::More tests => 2 + 6 * 24 + 5 + 1;
 
 use strict;
 use warnings;
@@ -63,7 +64,7 @@ sub make_component_file {
 
     write_component_file(\@dir_list, $name_final, <<EOF);
 package $fullname;
-use Class::C3;
+use MRO::Compat;
 use base '$compbase';
 sub COMPONENT {
     my \$self = shift->next::method(\@_);
@@ -82,7 +83,11 @@ foreach my $component (@components) {
                         $component->{name});
 }
 
-eval "package $appclass; use Catalyst; __PACKAGE__->setup";
+my $shut_up_deprecated_warnings = q{
+    __PACKAGE__->log(Catalyst::Log->new('fatal'));
+};
+
+eval "package $appclass; use Catalyst; $shut_up_deprecated_warnings __PACKAGE__->setup";
 
 can_ok( $appclass, 'components');
 
@@ -141,6 +146,7 @@ foreach my $component (@components) {
 eval qq(
 package $appclass;
 use Catalyst;
+$shut_up_deprecated_warnings
 __PACKAGE__->config->{ setup_components } = {
     search_extra => [ '::Extra' ],
     except       => [ "${appclass}::Controller::Foo" ]
@@ -194,4 +200,17 @@ eval "package $appclass; use Catalyst; __PACKAGE__->setup";
 
 is($@, '', "Didn't load component twice");
 
+$appclass = "InnerComponent";
+
+{
+  package InnerComponent::Controller::Test;
+  use base 'Catalyst::Controller';
+}
+
+$INC{'InnerComponent/Controller/Test.pm'} = 1;
+
+eval "package $appclass; use Catalyst; __PACKAGE__->setup";
+
+isa_ok($appclass->controller('Test'), 'Catalyst::Controller');
+
 rmtree($libdir);