| Conditions | 2 |
| Paths | 1 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | public function testSubmitValidData() |
||
| 11 | { |
||
| 12 | $formData = [ |
||
| 13 | 'test' => 'test', |
||
| 14 | 'test2' => 'test2', |
||
| 15 | ]; |
||
| 16 | |||
| 17 | $type = new SimpleArrayType(); |
||
| 18 | $form = $this->factory->create( |
||
| 19 | method_exists($type, 'getBlockPrefix') ? get_class($type) : $type |
||
|
|
|||
| 20 | ); |
||
| 21 | |||
| 22 | // submit the data to the form directly |
||
| 23 | $form->submit($formData); |
||
| 24 | |||
| 25 | $this->assertTrue($form->isSynchronized()); |
||
| 26 | $this->assertEquals($formData, $form->getData()); |
||
| 27 | } |
||
| 28 | } |
||
| 29 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.