[BUGFIX] Call initializeObject() after instantiating empty objects
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Tests / Unit / Object / Container / Fixtures / ContainerConstructorInjectionTestFixtures.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Tests\Unit\Object\Container\Fixtures;
3
4
5 class SimpleTypeConstructorArgument {
6
7 /**
8 * @var bool
9 */
10 public $foo;
11
12 /**
13 * @param bool $foo
14 */
15 public function __construct($foo = FALSE) {
16 $this->foo = $foo;
17 }
18 }
19
20
21 class ArgumentTestClass {
22
23 }
24
25
26 class MandatoryConstructorArgument {
27
28 /**
29 * @var ArgumentTestClass
30 */
31 public $argumentTestClass;
32
33 public $allArguments;
34
35 /**
36 * @param ArgumentTestClass $argumentTestClass
37 */
38 public function __construct(ArgumentTestClass $argumentTestClass) {
39 $this->argumentTestClass = $argumentTestClass;
40 $this->allArguments = func_get_args();
41 }
42 }
43
44
45 class OptionalConstructorArgument {
46
47 /**
48 * @var ArgumentTestClass
49 */
50 public $argumentTestClass;
51
52 /**
53 * @param ArgumentTestClass $argumentTestClass
54 */
55 public function __construct(ArgumentTestClass $argumentTestClass = NULL) {
56 $this->argumentTestClass = $argumentTestClass;
57 }
58 }
59
60
61 class MandatoryConstructorArgumentTwo {
62
63 /**
64 * @var ArgumentTestClass
65 */
66 public $argumentTestClass;
67
68 /**
69 * @var ArgumentTestClass
70 */
71 public $argumentTestClassTwo;
72
73 /**
74 * @param ArgumentTestClass $argumentTestClass
75 * @param ArgumentTestClass $argumentTestClassTwo
76 */
77 public function __construct(ArgumentTestClass $argumentTestClass, ArgumentTestClass $argumentTestClassTwo) {
78 $this->argumentTestClass = $argumentTestClass;
79 $this->argumentTestClassTwo = $argumentTestClassTwo;
80 }
81 }
82
83
84 class TwoConstructorArgumentsSecondOptional {
85
86 /**
87 * @var ArgumentTestClass
88 */
89 public $argumentTestClass;
90
91 /**
92 * @var ArgumentTestClass
93 */
94 public $argumentTestClassTwo;
95
96 /**
97 * @param ArgumentTestClass $argumentTestClass
98 * @param ArgumentTestClass $argumentTestClassTwo
99 */
100 public function __construct(ArgumentTestClass $argumentTestClass, ArgumentTestClass $argumentTestClassTwo = NULL) {
101 $this->argumentTestClass = $argumentTestClass;
102 $this->argumentTestClassTwo = $argumentTestClassTwo;
103 }
104 }
105
106
107 class TwoConstructorArgumentsFirstOptional {
108
109 /**
110 * @var ArgumentTestClass
111 */
112 public $argumentTestClass;
113
114 /**
115 * @var ArgumentTestClass
116 */
117 public $argumentTestClassTwo;
118
119 /**
120 * The extbase container code uses PHP parameter reflection isOptional() to determine
121 * injection. PHP behaves differently in current supported core versions, in effect
122 * constructor injection of the first argument can not be relied on.
123 *
124 * The according unit tests currently do not check the value of first argument.
125 *
126 * @see https://bugs.php.net/bug.php?id=62715
127 *
128 * @param ArgumentTestClass $argumentTestClass
129 * @param ArgumentTestClass $argumentTestClassTwo
130 */
131 public function __construct(ArgumentTestClass $argumentTestClass = NULL, ArgumentTestClass $argumentTestClassTwo) {
132 $this->argumentTestClass = $argumentTestClass;
133 $this->argumentTestClassTwo = $argumentTestClassTwo;
134 }
135 }
136
137
138 class TwoConstructorArgumentsBothOptional {
139
140 /**
141 * @var ArgumentTestClass
142 */
143 public $argumentTestClass;
144
145 /**
146 * @var ArgumentTestClass
147 */
148 public $argumentTestClassTwo;
149
150 /**
151 * @param ArgumentTestClass $argumentTestClass
152 * @param ArgumentTestClass $argumentTestClassTwo
153 */
154 public function __construct(ArgumentTestClass $argumentTestClass = NULL, ArgumentTestClass $argumentTestClassTwo = NULL) {
155 $this->argumentTestClass = $argumentTestClass;
156 $this->argumentTestClassTwo = $argumentTestClassTwo;
157 }
158
159 }