lets simplify stuff
[catagits/Catalyst-Runtime.git] / t / lib / TestAppCustomContainer / NoSugarContainer.pm
index 0dc9186..350842b 100644 (file)
@@ -8,43 +8,33 @@ extends 'Catalyst::IOC::Container';
 sub BUILD {
     my $self = shift;
 
-    warn("Add Bar to model");
+    warn("Add SingletonLifeCycle to model");
     $self->get_sub_container('model')->add_service(
         Catalyst::IOC::ConstructorInjection->new(
-            name             => 'Bar',
+            name             => 'SingletonLifeCycle',
             lifecycle        => 'Singleton',
-            class            => 'TestAppCustomContainer::Model::Bar',
+            class            => 'TestAppCustomContainer::Model::SingletonLifeCycle',
+            catalyst_component_name => 'TestAppCustomContainer::Model::SingletonLifeCycle',
             dependencies     => {
                 application_name => depends_on( '/application_name' ),
-                config => depends_on( '/config' ),
                 foo => depends_on('/model/DefaultSetup'),
             },
         )
     );
 
-#    $self->get_sub_container('model')->add_service(
-#        # FIXME - i think it should be a ConstructorInjection
-#        # but only BlockInjection gets ctx parameter
-#        Catalyst::IOC::BlockInjection->new(
-#            name         => 'Baz',
-#            lifecycle    => '+Catalyst::IOC::LifeCycle::Request',
-#            dependencies => [
-#                Bread::Board::Dependency->new(
-#                    service_name => 'foo',
-#                    service_path => 'Foo',
-#
-#                    # FIXME - same as above
-#                    service_params => {
-#                        ctx => +{},
-#                        accept_context_args => [ +{} ],
-#                    },
-#                ),
-#            ],
-#            block => sub {
-#                TestAppCustomContainer::Model::Baz->new(foo => shift->param('foo'));
-#            },
-#        )
-#    );
+    $self->get_sub_container('model')->add_service(
+        # FIXME - i think it should be a ConstructorInjection
+        # but only BlockInjection gets ctx parameter
+        Catalyst::IOC::ConstructorInjection->new(
+            name         => 'RequestLifeCycle',
+            lifecycle    => '+Catalyst::IOC::LifeCycle::Request',
+            class        => 'TestAppCustomContainer::Model::RequestLifeCycle',
+            dependencies => {
+                application_name => depends_on( '/application_name' ),
+                foo => depends_on('/model/DefaultSetup'),
+            },
+        )
+    );
 
 # Broken deps!?!
 #    $self->get_sub_container('model')->add_service(
@@ -58,6 +48,7 @@ sub BUILD {
 #        )
 #    );
 
+    my $fnar_config = $self->resolve(service => 'config')->{'Model::Fnar'} || {};
     $self->get_sub_container('component')->add_service(
         Catalyst::IOC::ConstructorInjection->new(
             name         => 'model_Fnar',
@@ -65,8 +56,8 @@ sub BUILD {
             class        => 'TestAppCustomContainer::External::Class',
             dependencies => [
                 depends_on( '/application_name' ),
-                depends_on( '/config' ),
             ],
+            config => $fnar_config,
         )
     );
     $self->get_sub_container('model')->add_service(