annotate _test/Test/Config/Container.pm @ 418:3f38dabaf5cc ref20150831

sync
author cin
date Mon, 28 Dec 2015 15:11:35 +0300
parents 3ed0c58e9da3
children b0481c071bea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
417
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
1 package Test::Config::Container;
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
2 use strict;
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
3
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
4 {
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
5 package Test::Config::Container::Baz;
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
6 use IMPL::declare {
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
7 base => {
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
8 'IMPL::Object' => undef
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
9 },
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
10 props => [
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
11 value => 'r'
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
12 ]
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
13 };
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
14
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
15 sub CTOR {
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
16 my $this = shift;
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
17 $this->value(shift);
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
18 }
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
19 }
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
20
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
21 use IMPL::declare {
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
22 require => {
418
cin
parents: 417
diff changeset
23 Container => 'IMPL::Config::Container',
cin
parents: 417
diff changeset
24
417
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
25 },
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
26 base => {
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
27 'IMPL::Test::Unit' => '@_'
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
28 }
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
29 };
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
30 use IMPL::Test qw(test assert failed);
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
31
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
32 test CreateContainer => sub {
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
33 my $c1 = Container->new();
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
34 };
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
35
418
cin
parents: 417
diff changeset
36 test RegisterServices => sub {
417
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
37 my $c1 = Container->new();
418
cin
parents: 417
diff changeset
38
cin
parents: 417
diff changeset
39 $c1->Register( 'db' => Service->new(
cin
parents: 417
diff changeset
40 type => 'Foo::Data',
cin
parents: 417
diff changeset
41 norequire => 1,
cin
parents: 417
diff changeset
42 activation => 'container'
cin
parents: 417
diff changeset
43 ));
cin
parents: 417
diff changeset
44
cin
parents: 417
diff changeset
45 return $c1;
cin
parents: 417
diff changeset
46 };
cin
parents: 417
diff changeset
47
cin
parents: 417
diff changeset
48 test ResolveServices => sub {
cin
parents: 417
diff changeset
49
cin
parents: 417
diff changeset
50 };
417
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
51
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
52
3ed0c58e9da3 working on di container, tests
cin
parents:
diff changeset
53 1;