X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faggregate%2Funit_core_component_loading.t;h=19a316cd671e9cacf8dd4cea546c7b932f56cdb8;hb=b8c160a4a02cba800468b8bba63e244da662b694;hp=2b3e205b273a715ad8b950cd763759c8b8fdd953;hpb=89b6b254a923f245093d323d9f526b891c8c866f;p=catagits%2FCatalyst-Runtime.git diff --git a/t/aggregate/unit_core_component_loading.t b/t/aggregate/unit_core_component_loading.t index 2b3e205..19a316c 100644 --- a/t/aggregate/unit_core_component_loading.t +++ b/t/aggregate/unit_core_component_loading.t @@ -1,8 +1,5 @@ -# 3 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 -# One test for components in inner packages -use Test::More tests => 3 + 6 * 24 + 9 + 1; +# way too many tests to count +use Test::More; use strict; use warnings; @@ -103,8 +100,7 @@ can_ok( $appclass, 'components'); my $complist = $appclass->components; -# the +1 below is for the app class itself -is(scalar keys %$complist, 24+1, "Correct number of components loaded"); +is(scalar keys %$complist, 24, "Correct number of components loaded"); foreach (keys %$complist) { @@ -157,45 +153,49 @@ 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" ] -}; -__PACKAGE__->setup; -); - -{ - my $config = { +SKIP: { + # FIXME - any backcompat planned? + skip "search_extra has been removed", 5; + eval qq( + package $appclass; + use Catalyst; + $shut_up_deprecated_warnings + __PACKAGE__->config->{ setup_components } = { search_extra => [ '::Extra' ], except => [ "${appclass}::Controller::Foo" ] }; - my @components_located = $appclass->locate_components($config); - my @components_expected; - for (@components) { - my $name = $appclass . '::' . $_->{prefix} . '::' . $_->{name}; - push @components_expected, $name if $name ne "${appclass}::Controller::Foo"; - } - is_deeply( - [ sort @components_located ], - [ sort @components_expected ], - 'locate_components finds the components correctly' + __PACKAGE__->setup; ); -} -can_ok( $appclass, 'components'); + { + my $config = { + search_extra => [ '::Extra' ], + except => [ "${appclass}::Controller::Foo" ] + }; + my @components_located = $appclass->locate_components($config); + my @components_expected; + for (@components) { + my $name = $appclass . '::' . $_->{prefix} . '::' . $_->{name}; + push @components_expected, $name if $name ne "${appclass}::Controller::Foo"; + } + is_deeply( + [ sort @components_located ], + [ sort @components_expected ], + 'locate_components finds the components correctly' + ); + } -$complist = $appclass->components; + can_ok( $appclass, 'components'); -is(scalar keys %$complist, 24+1, "Correct number of components loaded"); + $complist = $appclass->components; -ok( !exists $complist->{ "${appclass}::Controller::Foo" }, 'Controller::Foo was skipped' ); -ok( exists $complist->{ "${appclass}::Extra::Foo" }, 'Extra::Foo was loaded' ); + is(scalar keys %$complist, 24+1, "Correct number of components loaded"); -rmtree($libdir); + ok( !exists $complist->{ "${appclass}::Controller::Foo" }, 'Controller::Foo was skipped' ); + ok( exists $complist->{ "${appclass}::Extra::Foo" }, 'Extra::Foo was loaded' ); + + rmtree($libdir); +} $appclass = "ComponentOnce"; @@ -238,8 +238,9 @@ eval "package $appclass; use Catalyst; __PACKAGE__->setup"; is($@, '', "Didn't load component twice"); is($appclass->model('TopLevel::Nested')->called,1, 'COMPONENT called once'); -ok($appclass->model('TopLevel::Generated'), 'Have generated model'); -is(ref($appclass->model('TopLevel::Generated')), 'FooBarBazQuux', +# FIXME - OMG why should this even work?!! +ok($appclass->model('TopLevel::GENERATED'), 'Have generated model'); +is(ref($appclass->model('TopLevel::GENERATED')), 'FooBarBazQuux', 'ACCEPT_CONTEXT in generated inner package fired as expected'); $appclass = "InnerComponent"; @@ -256,3 +257,5 @@ eval "package $appclass; use Catalyst; __PACKAGE__->setup"; isa_ok($appclass->controller('Test'), 'Catalyst::Controller'); rmtree($libdir); + +done_testing;