1 | <?php |
||
12 | class Container extends PimpleContainer |
||
13 | { |
||
14 | const NAME = 'PHPChunkit'; |
||
15 | const VERSION = '0.0.1'; |
||
16 | |||
17 | 2 | public function initialize() |
|
18 | { |
||
19 | $this['phpchunkit.configuration'] = function() { |
||
20 | 1 | return $this->getConfiguration(); |
|
21 | }; |
||
22 | |||
23 | $this['phpchunkit.symfony_application'] = function() { |
||
24 | return new Application(self::NAME, self::VERSION); |
||
25 | }; |
||
26 | |||
27 | $this['phpchunkit.application'] = function() { |
||
28 | return new PHPChunkitApplication($this); |
||
29 | }; |
||
30 | |||
31 | $this['phpchunkit.database_sandbox'] = function() { |
||
32 | return $this['phpchunkit.configuration']->getDatabaseSandbox(); |
||
33 | }; |
||
34 | |||
35 | $this['phpchunkit.event_dispatcher'] = function() { |
||
36 | return $this['phpchunkit.configuration']->getEventDispatcher(); |
||
37 | }; |
||
38 | |||
39 | $this['phpchunkit.test_chunker'] = function() { |
||
40 | return new TestChunker($this['phpchunkit.test_counter']); |
||
41 | }; |
||
42 | |||
43 | $this['phpchunkit.test_runner'] = function() { |
||
44 | return new TestRunner( |
||
45 | $this['phpchunkit.symfony_application'], |
||
46 | $this['phpchunkit.application.input'], |
||
47 | $this['phpchunkit.application.output'], |
||
48 | $this['phpchunkit.configuration'] |
||
49 | ); |
||
50 | }; |
||
51 | |||
52 | $this['phpchunkit.test_counter'] = function() { |
||
53 | return new TestCounter( |
||
54 | $this['phpchunkit.file_classes_helper'] |
||
55 | ); |
||
56 | }; |
||
57 | |||
58 | $this['phpchunkit.test_finder'] = function() { |
||
59 | return new TestFinder( |
||
60 | $this['phpchunkit.configuration']->getTestsDirectory() |
||
61 | ); |
||
62 | }; |
||
63 | |||
64 | $this['phpchunkit.command.setup'] = function() { |
||
65 | return new Command\Setup(); |
||
66 | }; |
||
67 | |||
68 | $this['phpchunkit.command.test_watcher'] = function() { |
||
69 | return new Command\TestWatcher( |
||
70 | $this['phpchunkit.test_runner'], |
||
71 | $this['phpchunkit.configuration'], |
||
72 | $this['phpchunkit.file_classes_helper'] |
||
73 | ); |
||
74 | }; |
||
75 | |||
76 | $this['phpchunkit.command.run'] = function() { |
||
77 | return new Command\Run( |
||
78 | $this['phpchunkit.test_runner'], |
||
79 | $this['phpchunkit.configuration'], |
||
80 | $this['phpchunkit.test_chunker'], |
||
81 | $this['phpchunkit.test_finder'] |
||
82 | ); |
||
83 | }; |
||
84 | |||
85 | $this['phpchunkit.command.create_databases'] = function() { |
||
86 | return new Command\CreateDatabases($this['phpchunkit.event_dispatcher']); |
||
87 | }; |
||
88 | |||
89 | $this['phpchunkit.command.build_sandbox'] = function() { |
||
90 | return new Command\BuildSandbox( |
||
91 | $this['phpchunkit.test_runner'], |
||
92 | $this['phpchunkit.event_dispatcher'] |
||
93 | ); |
||
94 | }; |
||
95 | |||
96 | $this['phpchunkit.command.generate_test'] = function() { |
||
97 | return new Command\Generate(new GenerateTestClass()); |
||
98 | }; |
||
99 | |||
100 | $this['phpchunkit.file_classes_helper'] = function() { |
||
101 | return new FileClassesHelper(); |
||
102 | }; |
||
103 | 2 | } |
|
104 | |||
105 | 1 | private function getConfiguration() : Configuration |
|
147 | |||
148 | 1 | private function loadConfiguration() : Configuration |
|
165 | |||
166 | private function isSandboxEnabled() : bool |
||
172 | |||
173 | /** |
||
174 | * @return null|string |
||
175 | */ |
||
176 | 1 | private function findPHPChunkitXmlPath() |
|
186 | |||
187 | /** |
||
188 | * @throws InvalidArgumentException |
||
189 | */ |
||
190 | 1 | private function loadPHPChunkitBootstrap(Configuration $configuration) |
|
208 | } |
||
209 |