X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Finject_component_util.t;h=5b9c2d0eaa73830e6213888770f921abbdc64ef0;hb=298b97911aafbd8c62ce2902e91237e0f8920a24;hp=7162202615b7a39a099aa9cfbb3d706d9ef3f1f8;hpb=d5c890a4433058eb9fb0ac7f23cd264d38e6cff0;p=catagits%2FCatalyst-Runtime.git diff --git a/t/inject_component_util.t b/t/inject_component_util.t index 7162202..5b9c2d0 100644 --- a/t/inject_component_util.t +++ b/t/inject_component_util.t @@ -6,10 +6,29 @@ use FindBin; use lib "$FindBin::Bin/lib"; BEGIN { +package RoleTest1; + +use Moose::Role; + +sub aaa { 'aaa' } + +package RoleTest2; + +use Moose::Role; + +sub bbb { 'bbb' } + package Model::Banana; use base qw/Catalyst::Model/; + +package Model::BananaMoose; +use Moose; +extends 'Catalyst::Model'; + +Model::BananaMoose->meta->make_immutable; + package TestCatalyst; $INC{'TestCatalyst.pm'} = 1; use Catalyst::Runtime '5.70'; @@ -24,7 +43,9 @@ after 'setup_components' => sub { Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Model::Banana' ); Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Test::Apple' ); Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Model::Banana', as => 'Cherry' ); + Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Model::BananaMoose', as => 'CherryMoose', traits => ['RoleTest1', 'RoleTest2'] ); Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Test::Apple', as => 'Apple' ); + Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Test::Apple', as => 'Apple2', traits => ['RoleTest1', 'RoleTest2'] ); }; TestCatalyst->config( 'home' => '.' ); @@ -39,5 +60,9 @@ use Catalyst::Test qw/TestCatalyst/; ok( TestCatalyst->controller( $_ ) ) for qw/ Apple Test::Apple /; ok( TestCatalyst->model( $_ ) ) for qw/ Banana Cherry /; +is( TestCatalyst->controller('Apple2')->aaa, 'aaa'); +is( TestCatalyst->controller('Apple2')->bbb, 'bbb'); +is( TestCatalyst->model('CherryMoose')->aaa, 'aaa'); +is( TestCatalyst->model('CherryMoose')->bbb, 'bbb'); done_testing;