Conditions | 2 |
Paths | 2 |
Total Lines | 27 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public function testFormType() |
||
15 | { |
||
16 | $formData = [ |
||
17 | 'value' => 'beer', |
||
18 | ]; |
||
19 | |||
20 | $form = $this->factory->create(ChoiceFormSubmissionType::class, null, ['choices' => [ |
||
21 | 'beer' => 'bier', |
||
22 | 'wine' => 'wijn', |
||
23 | ]]); |
||
24 | |||
25 | $object = new ChoiceFormSubmissionField(); |
||
26 | $object->setValue('beer'); |
||
|
|||
27 | |||
28 | $form->submit($formData); |
||
29 | |||
30 | $this->assertTrue($form->isSynchronized()); |
||
31 | $this->assertTrue($form->isValid()); |
||
32 | $this->assertEquals($object, $form->getData()); |
||
33 | |||
34 | $view = $form->createView(); |
||
35 | $children = $view->children; |
||
36 | |||
37 | foreach (array_keys($formData) as $key) { |
||
38 | $this->assertArrayHasKey($key, $children); |
||
39 | } |
||
40 | } |
||
41 | } |
||
42 |
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: