[TASK] Namespace classes
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Object / Container / Fixtures / Testclasses.php
1 <?php
2 namespace ;
3
4 /**
5 * a singleton class
6 */
7 class t3lib_object_tests_singleton implements \TYPO3\CMS\Core\SingletonInterface {
8
9
10 }
11
12
13 namespace ;
14
15 /**
16 * test class A that depends on B and C
17 */
18 class t3lib_object_tests_a {
19
20 public $b;
21
22 public $c;
23
24 /**
25 * @param \t3lib_object_tests_c $c
26 * @param \t3lib_object_tests_b $b
27 */
28 public function __construct(\t3lib_object_tests_c $c, \t3lib_object_tests_b $b) {
29 $this->b = $b;
30 $this->c = $c;
31 }
32
33 }
34
35
36 namespace ;
37
38 /**
39 * test class A that depends on B and C and has a third default parameter in constructor
40 */
41 class t3lib_object_tests_amixed_array {
42
43 public $b;
44
45 public $c;
46
47 public $myvalue;
48
49 /**
50 * @param \t3lib_object_tests_b $b
51 * @param \t3lib_object_tests_c $c
52 * @param array $myvalue
53 */
54 public function __construct(\t3lib_object_tests_b $b, \t3lib_object_tests_c $c, array $myvalue = array('some' => 'default')) {
55 $this->b = $b;
56 $this->c = $c;
57 $this->myvalue = $myvalue;
58 }
59
60 }
61
62
63 namespace ;
64
65 /**
66 * test class A that depends on B and C and has a third default parameter in constructor that defaults to NULL
67 */
68 class t3lib_object_tests_amixed_null {
69
70 public $b;
71
72 public $c;
73
74 public $myvalue;
75
76 /**
77 * @param \t3lib_object_tests_b $b
78 * @param \t3lib_object_tests_c $c
79 * @param mixed $myvalue
80 */
81 public function __construct(\t3lib_object_tests_b $b, \t3lib_object_tests_c $c, $myvalue = NULL) {
82 $this->b = $b;
83 $this->c = $c;
84 $this->myvalue = $myvalue;
85 }
86
87 }
88
89
90 namespace ;
91
92 /**
93 * test class A that depends on B and C and has a third default parameter in constructor
94 */
95 class t3lib_object_tests_amixed_array_singleton implements \TYPO3\CMS\Core\SingletonInterface {
96
97 public $b;
98
99 public $c;
100
101 public $myvalue;
102
103 /**
104 * @param \t3lib_object_tests_b $b
105 * @param \t3lib_object_tests_c $c
106 * @param array $someDefaultParameter
107 */
108 public function __construct(\t3lib_object_tests_b $b, \t3lib_object_tests_c $c, $someDefaultParameter = array('some' => 'default')) {
109 $this->b = $b;
110 $this->c = $c;
111 $this->myvalue = $someDefaultParameter;
112 }
113
114 }
115
116
117 namespace ;
118
119 /**
120 * test class B that depends on C
121 */
122 class t3lib_object_tests_b implements \TYPO3\CMS\Core\SingletonInterface {
123
124 public $c;
125
126 /**
127 * @param \t3lib_object_tests_c $c
128 */
129 public function __construct(\t3lib_object_tests_c $c) {
130 $this->c = $c;
131 }
132
133 }
134
135
136 namespace ;
137
138 /**
139 * test class C without dependencys
140 */
141 class t3lib_object_tests_c implements \TYPO3\CMS\Core\SingletonInterface {
142
143
144 }
145
146
147 namespace ;
148
149 /**
150 * test class B-Child that extends Class B (therfore depends also on Class C)
151 */
152 class t3lib_object_tests_b_child extends \t3lib_object_tests_b {
153
154
155 }
156
157
158 namespace ;
159
160 /**
161
162 */
163 interface t3lib_object_tests_someinterface extends \TYPO3\CMS\Core\SingletonInterface
164 {
165
166 }
167
168 namespace ;
169
170 /**
171 * class which implements a Interface
172 */
173 class t3lib_object_tests_someimplementation implements \t3lib_object_tests_someinterface {
174
175
176 }
177
178
179 namespace ;
180
181 /**
182 * test class B-Child that extends Class B (therfore depends also on Class C)
183 */
184 class t3lib_object_tests_b_child_someimplementation extends \t3lib_object_tests_b implements \t3lib_object_tests_someinterface {
185
186
187 }
188
189
190 namespace ;
191
192 /**
193 * class which depends on a Interface
194 */
195 class t3lib_object_tests_needsinterface {
196
197 /**
198 * @param \t3lib_object_tests_someinterface $i
199 */
200 public function __construct(\t3lib_object_tests_someinterface $i) {
201 $this->dependency = $i;
202 }
203
204 }
205
206
207 namespace ;
208
209 /**
210 * Prototype classes that depend on each other
211 */
212 class t3lib_object_tests_cyclic1 {
213
214 /**
215 * @param \t3lib_object_tests_cyclic2 $c
216 */
217 public function __construct(\t3lib_object_tests_cyclic2 $c) {
218
219 }
220
221 }
222
223
224 namespace ;
225
226 /**
227
228 */
229 class t3lib_object_tests_cyclic2 {
230
231 /**
232 * @param \t3lib_object_tests_cyclic1 $c
233 */
234 public function __construct(\t3lib_object_tests_cyclic1 $c) {
235
236 }
237
238 }
239
240
241 namespace ;
242
243 /**
244
245 */
246 class t3lib_object_tests_cyclic1WithSetterDependency {
247
248 /**
249 * @param \t3lib_object_tests_cyclic2WithSetterDependency $c
250 */
251 public function injectFoo(\t3lib_object_tests_cyclic2WithSetterDependency $c) {
252
253 }
254
255 }
256
257
258 namespace ;
259
260 /**
261
262 */
263 class t3lib_object_tests_cyclic2WithSetterDependency {
264
265 /**
266 * @param \t3lib_object_tests_cyclic1WithSetterDependency $c
267 */
268 public function injectFoo(\t3lib_object_tests_cyclic1WithSetterDependency $c) {
269
270 }
271
272 }
273
274
275 namespace ;
276
277 /**
278 * class which has setter injections defined
279 */
280 class t3lib_object_tests_injectmethods {
281
282 public $b;
283
284 public $bchild;
285
286 /**
287 * @param \t3lib_object_tests_b $o
288 */
289 public function injectClassB(\t3lib_object_tests_b $o) {
290 $this->b = $o;
291 }
292
293 /**
294 * @inject
295 * @param \t3lib_object_tests_b_child $o
296 */
297 public function setClassBChild(\t3lib_object_tests_b_child $o) {
298 $this->bchild = $o;
299 }
300
301 }
302
303
304 namespace ;
305
306 /**
307 * class which needs extenson settings injected
308 */
309 class t3lib_object_tests_injectsettings {
310
311 public $settings;
312
313 /**
314 * @param array $settings
315 */
316 public function injectExtensionSettings(array $settings) {
317 $this->settings = $settings;
318 }
319
320 }
321
322
323 namespace ;
324
325 /**
326
327 */
328 class t3lib_object_tests_resolveablecyclic1 implements \TYPO3\CMS\Core\SingletonInterface {
329
330 public $o2;
331
332 /**
333 * @param \t3lib_object_tests_resolveablecyclic2 $cyclic2
334 */
335 public function __construct(\t3lib_object_tests_resolveablecyclic2 $cyclic2) {
336 $this->o2 = $cyclic2;
337 }
338
339 }
340
341
342 namespace ;
343
344 /**
345
346 */
347 class t3lib_object_tests_resolveablecyclic2 implements \TYPO3\CMS\Core\SingletonInterface {
348
349 public $o1;
350
351 public $o3;
352
353 /**
354 * @param \t3lib_object_tests_resolveablecyclic1 $cyclic1
355 */
356 public function injectCyclic1(\t3lib_object_tests_resolveablecyclic1 $cyclic1) {
357 $this->o1 = $cyclic1;
358 }
359
360 /**
361 * @param \t3lib_object_tests_resolveablecyclic3 $cyclic3
362 */
363 public function injectCyclic3(\t3lib_object_tests_resolveablecyclic3 $cyclic3) {
364 $this->o3 = $cyclic3;
365 }
366
367 }
368
369
370 namespace ;
371
372 /**
373
374 */
375 class t3lib_object_tests_resolveablecyclic3 implements \TYPO3\CMS\Core\SingletonInterface {
376
377 public $o1;
378
379 /**
380 * @param \t3lib_object_tests_resolveablecyclic1 $cyclic1
381 */
382 public function injectCyclic1(\t3lib_object_tests_resolveablecyclic1 $cyclic1) {
383 $this->o1 = $cyclic1;
384 }
385
386 }
387
388
389 namespace ;
390
391 /**
392
393 */
394 class t3lib_object_tests_class_with_injectsettings {
395
396 /**
397 * @param \t3lib_object_tests_resolveablecyclic1 $c1
398 */
399 public function injectFoo(\t3lib_object_tests_resolveablecyclic1 $c1) {
400
401 }
402
403 /**
404 * @param array $settings
405 */
406 public function injectSettings(array $settings) {
407
408 }
409
410 }
411
412
413 namespace ;
414
415 /*
416 * a Singleton requires a Prototype for Injection -> allowed, autowiring active, but in development context we write a log message, as it is bad practice and most likely points to some logic error.
417 If a Singleton requires a Singleton for Injection -> allowed, autowiring active
418 If a Prototype requires a Prototype for Injection -> allowed, autowiring active
419 If a Prototype requires a Singleton for Injection -> allowed, autowiring active
420 */
421 /**
422
423 */
424 class t3lib_object_singleton implements \TYPO3\CMS\Core\SingletonInterface {
425
426
427 }
428
429
430 namespace ;
431
432 /**
433
434 */
435 class t3lib_object_prototype {
436
437
438 }
439
440
441 namespace ;
442
443 /**
444
445 */
446 class t3lib_object_singletonNeedsPrototype implements \TYPO3\CMS\Core\SingletonInterface {
447
448 /**
449 * @var \t3lib_object_prototype
450 */
451 public $dependency;
452
453 /**
454 * @param \t3lib_object_prototype $dependency
455 */
456 public function injectDependency(\t3lib_object_prototype $dependency) {
457 $this->dependency = $dependency;
458 }
459
460 }
461
462
463 namespace ;
464
465 /**
466
467 */
468 class t3lib_object_singletonNeedsSingleton implements \TYPO3\CMS\Core\SingletonInterface {
469
470 /**
471 * @var \t3lib_object_singleton
472 */
473 public $dependency;
474
475 /**
476 * @param \t3lib_object_singleton $dependency
477 */
478 public function injectDependency(\t3lib_object_singleton $dependency) {
479 $this->dependency = $dependency;
480 }
481
482 }
483
484
485 namespace ;
486
487 /**
488
489 */
490 class t3lib_object_prototypeNeedsPrototype {
491
492 /**
493 * @var \t3lib_object_prototype
494 */
495 public $dependency;
496
497 /**
498 * @param \t3lib_object_prototype $dependency
499 */
500 public function injectDependency(\t3lib_object_prototype $dependency) {
501 $this->dependency = $dependency;
502 }
503
504 }
505
506
507 namespace ;
508
509 /**
510
511 */
512 class t3lib_object_prototypeNeedsSingleton {
513
514 /**
515 * @var \t3lib_object_singleton
516 */
517 public $dependency;
518
519 /**
520 * @param \t3lib_object_singleton $dependency
521 */
522 public function injectDependency(\t3lib_object_singleton $dependency) {
523 $this->dependency = $dependency;
524 }
525
526 }
527
528
529 namespace ;
530
531 /**
532
533 */
534 class t3lib_object_singletonNeedsPrototypeInConstructor implements \TYPO3\CMS\Core\SingletonInterface {
535
536 /**
537 * @param \t3lib_object_prototype $dependency
538 */
539 public function __construct(\t3lib_object_prototype $dependency) {
540 $this->dependency = $dependency;
541 }
542
543 }
544
545
546 namespace ;
547
548 /**
549
550 */
551 class t3lib_object_singletonNeedsSingletonInConstructor implements \TYPO3\CMS\Core\SingletonInterface {
552
553 /**
554 * @param \t3lib_object_singleton $dependency
555 */
556 public function __construct(\t3lib_object_singleton $dependency) {
557 $this->dependency = $dependency;
558 }
559
560 }
561
562
563 namespace ;
564
565 /**
566
567 */
568 class t3lib_object_prototypeNeedsPrototypeInConstructor {
569
570 /**
571 * @param \t3lib_object_prototype $dependency
572 */
573 public function __construct(\t3lib_object_prototype $dependency) {
574 $this->dependency = $dependency;
575 }
576
577 }
578
579
580 namespace ;
581
582 /**
583
584 */
585 class t3lib_object_prototypeNeedsSingletonInConstructor {
586
587 /**
588 * @param \t3lib_object_singleton $dependency
589 */
590 public function __construct(\t3lib_object_singleton $dependency) {
591 $this->dependency = $dependency;
592 }
593
594 }
595
596
597 ?>