These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the Black package. |
||
5 | * |
||
6 | * (c) Alexandre 'pocky' Balmes <[email protected]> |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Tests\Black\Component\Common\Application\Form\Type; |
||
13 | |||
14 | use Black\Component\Common\Application\Form\Type\TagType; |
||
15 | use Symfony\Component\Form\Forms; |
||
16 | |||
17 | /** |
||
18 | * Class TagTypeTest |
||
19 | */ |
||
20 | class TagTypeTest extends \PHPUnit_Framework_TestCase |
||
21 | { |
||
22 | protected $factory; |
||
23 | |||
24 | protected $prophet; |
||
25 | |||
26 | public function testSubmitValidData() |
||
27 | { |
||
28 | $formData = 'test, test1'; |
||
29 | |||
30 | $type = new TagType('tag_type'); |
||
0 ignored issues
–
show
|
|||
31 | $form = $this->factory->create($type); |
||
32 | |||
33 | $form->submit($formData); |
||
34 | |||
35 | $this->assertEquals('tag_type', $form->getName()); |
||
36 | $this->assertTrue($form->isSynchronized()); |
||
37 | $this->assertEquals([0 => 'test', 1 => 'test1'], $form->getData()); |
||
38 | } |
||
39 | |||
40 | protected function setUp() |
||
41 | { |
||
42 | $this->factory = Forms::createFormFactoryBuilder()->getFormFactory(); |
||
43 | } |
||
44 | } |
||
45 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.