6 use lib "$FindBin::Bin/lib";
21 package Model::Banana;
23 use base qw/Catalyst::Model/;
25 package Model::BananaMoose;
28 extends 'Catalyst::Model';
30 Model::BananaMoose->meta->make_immutable;
32 package TestCatalyst; $INC{'TestCatalyst.pm'} = 1;
34 use Catalyst::Runtime '5.70';
37 BEGIN { extends qw/Catalyst/ }
41 after 'setup_components' => sub {
43 Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Model::Banana' );
44 Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Test::Apple' );
45 Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Model::Banana', as => 'Cherry' );
46 Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Model::BananaMoose', as => 'CherryMoose', traits => ['RoleTest1', 'RoleTest2'] );
47 Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Test::Apple', as => 'Apple' );
48 Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Test::Apple', as => 'Apple2', traits => ['RoleTest1', 'RoleTest2'] );
51 TestCatalyst->config( 'home' => '.' );
59 use Catalyst::Test qw/TestCatalyst/;
61 ok( TestCatalyst->controller( $_ ) ) for qw/ Apple Test::Apple /;
62 ok( TestCatalyst->model( $_ ) ) for qw/ Banana Cherry /;
63 is( TestCatalyst->controller('Apple2')->aaa, 'aaa');
64 is( TestCatalyst->controller('Apple2')->bbb, 'bbb');
65 is( TestCatalyst->model('CherryMoose')->aaa, 'aaa');
66 is( TestCatalyst->model('CherryMoose')->bbb, 'bbb');