enabling new lifecycle in test + FIXME
[catagits/Catalyst-Runtime.git] / t / lib / TestAppCustomContainer / SugarContainer.pm
CommitLineData
88cea23c 1package TestAppCustomContainer::SugarContainer;
3ef84846 2use Moose;
88cea23c 3use namespace::autoclean;
4use Catalyst::IOC;
3ef84846 5
6extends 'Catalyst::IOC::Container';
7
88cea23c 8# translate to sugar
3ef84846 9sub BUILD {
10 my $self = shift;
11 $self->get_sub_container('component')->add_service(
12 Catalyst::IOC::ConstructorInjection->new(
13 name => 'model_Baz',
88cea23c 14 class => 'TestAppCustomContainer::Model::Baz',
b18a77bd 15
16# FIXME - it should simply be Request (or InstancePerRequest, etc)
17# see Bread/Board/Service.pm line 47
18 lifecycle => '+Catalyst::IOC::LifeCycle::Request',
3ef84846 19 dependencies => [
20 depends_on( '/application_name' ),
21 depends_on( '/config' ),
22 depends_on( '/model/Foo' ),
23 ],
24 )
25 );
26 $self->get_sub_container('model')->add_service(
27 Catalyst::IOC::BlockInjection->new(
28 name => 'Baz',
29 dependencies => [
30 depends_on( '/model/Foo' ),
31 depends_on( '/component/model_Baz' ),
32 ],
33 block => sub {
34 my $s = shift;
35 my $foo = $s->param('Foo');
36 my $instance = $s->param('model_Baz');
37 return $instance;
38 },
39 )
40 );
41}
42
88cea23c 43__PACKAGE__->meta->make_immutable;
44
3ef84846 451;