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