more details on the new core features
[catagits/Catalyst-Runtime.git] / t / inject_component_util.t
CommitLineData
ec4d7259 1use strict;
2use warnings;
3use Test::More;
4use Catalyst::Utils;
5
6BEGIN {
7package Model::Banana;
8
9use base qw/Catalyst::Model/;
10
11package TestCatalyst; $INC{'TestCatalyst.pm'} = 1;
12
13use Catalyst::Runtime '5.70';
14
15use Moose;
16BEGIN { extends qw/Catalyst/ }
17
18use Catalyst;
19
20after 'setup_components' => sub {
21 my $self = shift;
22 Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Model::Banana' );
23 Catalyst::Utils::inject_component( into => __PACKAGE__, component => 't::Test::Apple' );
24 Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Model::Banana', as => 'Cherry' );
25 Catalyst::Utils::inject_component( into => __PACKAGE__, component => 't::Test::Apple', as => 'Apple' );
26};
27
28TestCatalyst->config( 'home' => '.' );
29
30TestCatalyst->setup;
31
32}
33
34package main;
35
36use Catalyst::Test qw/TestCatalyst/;
37
38ok( TestCatalyst->controller( $_ ) ) for qw/ Apple t::Test::Apple /;
39ok( TestCatalyst->model( $_ ) ) for qw/ Banana Cherry /;
40
41done_testing;