fixed bugs in type constraints and cored some extensibility features
[catagits/Catalyst-Runtime.git] / t / inject_component_util.t
diff --git a/t/inject_component_util.t b/t/inject_component_util.t
new file mode 100644 (file)
index 0000000..c757d9c
--- /dev/null
@@ -0,0 +1,41 @@
+use strict;
+use warnings; 
+use Test::More;
+use Catalyst::Utils;
+BEGIN {
+package Model::Banana;
+use base qw/Catalyst::Model/;
+package TestCatalyst; $INC{'TestCatalyst.pm'} = 1;
+use Catalyst::Runtime '5.70';
+use Moose;
+BEGIN { extends qw/Catalyst/ }
+use Catalyst;
+after 'setup_components' => sub {
+    my $self = shift;
+    Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Model::Banana' );
+    Catalyst::Utils::inject_component( into => __PACKAGE__, component => 't::Test::Apple' );
+    Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Model::Banana', as => 'Cherry' );
+    Catalyst::Utils::inject_component( into => __PACKAGE__, component => 't::Test::Apple', as => 'Apple' );
+};
+TestCatalyst->config( 'home' => '.' );
+TestCatalyst->setup;
+}
+package main;
+use Catalyst::Test qw/TestCatalyst/;
+ok( TestCatalyst->controller( $_ ) ) for qw/ Apple t::Test::Apple /;
+ok( TestCatalyst->model( $_ ) ) for qw/ Banana Cherry /;
+
+done_testing;