These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\FormBundle\Tests\Event; |
||
4 | |||
5 | use Kunstmaan\FormBundle\Entity\AbstractFormPage; |
||
6 | use Kunstmaan\FormBundle\Entity\FormSubmission; |
||
7 | use Kunstmaan\FormBundle\Event\SubmissionEvent; |
||
8 | use PHPUnit\Framework\TestCase; |
||
9 | |||
10 | /** |
||
11 | * Class SubmissionEventTest |
||
12 | */ |
||
13 | class SubmissionEventTest extends TestCase |
||
14 | { |
||
15 | public function testEvent() |
||
16 | { |
||
17 | $submission = new FormSubmission(); |
||
18 | $page = $this->createMock(AbstractFormPage::class); |
||
19 | $page->method('getId')->willReturn(2); |
||
20 | |||
21 | $submission->setId(1); |
||
22 | |||
23 | $event = new SubmissionEvent($submission, $page); |
||
0 ignored issues
–
show
|
|||
24 | $this->assertInstanceOf(FormSubmission::class, $event->getSubmission()); |
||
25 | $this->assertEquals($page, $event->getPage()); |
||
26 | $this->assertEquals(1, $event->getSubmission()->getId()); |
||
27 | } |
||
28 | } |
||
29 |
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: