1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Kunstmaan\NodeBundle\Tests\Event; |
4
|
|
|
|
5
|
|
|
use Kunstmaan\AdminBundle\Helper\FormWidgets\Tabs\TabPane; |
6
|
|
|
use Kunstmaan\NodeBundle\Entity\Node; |
7
|
|
|
use Kunstmaan\NodeBundle\Entity\NodeTranslation; |
8
|
|
|
use Kunstmaan\NodeBundle\Entity\NodeVersion; |
9
|
|
|
use Kunstmaan\NodeBundle\Event\AdaptFormEvent; |
10
|
|
|
use PHPUnit\Framework\TestCase; |
11
|
|
|
use Symfony\Component\HttpFoundation\Request; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class AdaptFormEventTest |
15
|
|
|
*/ |
16
|
|
|
class AdaptFormEventTest extends TestCase |
17
|
|
|
{ |
18
|
|
|
public function testGetSet() |
19
|
|
|
{ |
20
|
|
|
$request = new Request(); |
21
|
|
|
/** @var TabPane $tabPane */ |
22
|
|
|
$tabPane = $this->createMock(TabPane::class); |
23
|
|
|
/** @var Node $node */ |
24
|
|
|
$node = $this->createMock(Node::class); |
25
|
|
|
/** @var NodeTranslation $nodeTranslation */ |
26
|
|
|
$nodeTranslation = $this->createMock(NodeTranslation::class); |
27
|
|
|
/** @var NodeVersion $nodeVersion */ |
28
|
|
|
$nodeVersion = $this->createMock(NodeVersion::class); |
29
|
|
|
|
30
|
|
|
$event = new AdaptFormEvent($request, $tabPane, 5, $node, $nodeTranslation, $nodeVersion); |
|
|
|
|
31
|
|
|
|
32
|
|
|
$this->assertInstanceOf(Request::class, $event->getRequest()); |
33
|
|
|
$this->assertInstanceOf(TabPane::class, $event->getTabPane()); |
34
|
|
|
$this->assertEquals(5, $event->getPage()); |
35
|
|
|
$this->assertInstanceOf(Node::class, $event->getNode()); |
36
|
|
|
$this->assertInstanceOf(NodeTranslation::class, $event->getNodeTranslation()); |
37
|
|
|
$this->assertInstanceOf(NodeVersion::class, $event->getNodeVersion()); |
38
|
|
|
} |
39
|
|
|
} |
40
|
|
|
|
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: