1 | <?php |
||
12 | class FormTest extends \PHPUnit_Framework_TestCase { |
||
13 | |||
14 | /** |
||
15 | * |
||
16 | */ |
||
17 | public function testIsValidFlush() { |
||
32 | |||
33 | |||
34 | /** |
||
35 | * |
||
36 | */ |
||
37 | public function testUid() { |
||
45 | |||
46 | |||
47 | /** |
||
48 | * |
||
49 | */ |
||
50 | public function testData() { |
||
65 | |||
66 | |||
67 | /** |
||
68 | * |
||
69 | */ |
||
70 | public function testGetElements() { |
||
74 | |||
75 | |||
76 | /** |
||
77 | * |
||
78 | */ |
||
79 | public function testFormMethods() { |
||
99 | |||
100 | |||
101 | /** |
||
102 | * |
||
103 | */ |
||
104 | public function testFormRender() { |
||
112 | |||
113 | |||
114 | /** |
||
115 | * |
||
116 | */ |
||
117 | public function testIsSubmittedFalse() { |
||
122 | |||
123 | |||
124 | /** |
||
125 | * |
||
126 | */ |
||
127 | public function testIsSubmittedTrue() { |
||
142 | |||
143 | |||
144 | /** |
||
145 | * |
||
146 | */ |
||
147 | public function testValidateWithoutSubmit() { |
||
153 | |||
154 | |||
155 | /** |
||
156 | * |
||
157 | */ |
||
158 | public function testFormSetData() { |
||
171 | |||
172 | |||
173 | /** |
||
174 | * @expectedException \Exception |
||
175 | */ |
||
176 | public function testAddElementsWithSameNames() { |
||
185 | |||
186 | |||
187 | /** |
||
188 | * |
||
189 | */ |
||
190 | public function testSetElementsWithSameNames() { |
||
206 | |||
207 | |||
208 | public function testFormValidationCache() { |
||
209 | $form = new Form(); |
||
210 | $form->setName('user_registration'); |
||
211 | |||
212 | |||
213 | $element = (new Input())->setName('test')->setValue('first'); |
||
214 | |||
215 | $checkedItemsNum = 0; |
||
216 | |||
217 | $element->addValidator(new CallBackValidator(function ($value) use (&$checkedItemsNum) { |
||
218 | $checkedItemsNum++; |
||
219 | |||
220 | return !empty($value); |
||
221 | })); |
||
222 | |||
223 | $form->setElement($element); |
||
224 | # emulate form submit |
||
225 | $form->setData([ |
||
226 | $form->getUid() => '1', |
||
227 | 'test' => '123', |
||
228 | ]); |
||
229 | |||
230 | $this->assertTrue($form->isValid()); |
||
231 | $this->assertEquals(1, $checkedItemsNum); |
||
232 | $this->assertTrue($form->isValid()); |
||
233 | $this->assertTrue($form->isValid()); |
||
234 | |||
235 | $this->assertEquals(1, $checkedItemsNum); |
||
236 | |||
237 | } |
||
257 | } |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: