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\NodeBundle\Tests\Event; |
||
4 | |||
5 | use Kunstmaan\NodeBundle\Entity\HasNodeInterface; |
||
6 | use Kunstmaan\NodeBundle\Entity\Node; |
||
7 | use Kunstmaan\NodeBundle\Entity\NodeTranslation; |
||
8 | use Kunstmaan\NodeBundle\Entity\NodeVersion; |
||
9 | use Kunstmaan\NodeBundle\Event\CopyPageTranslationNodeEvent; |
||
10 | use PHPUnit\Framework\TestCase; |
||
11 | |||
12 | /** |
||
13 | * Class ConfigureActionMenuEventTest |
||
14 | */ |
||
15 | View Code Duplication | class CopyPageTranslationNodeEventTest extends TestCase |
|
16 | { |
||
17 | public function testGetSet() |
||
18 | { |
||
19 | /** @var Node $node */ |
||
20 | $node = $this->createMock(Node::class); |
||
21 | /** @var NodeTranslation $nodeTranslation */ |
||
22 | $nodeTranslation = $this->createMock(NodeTranslation::class); |
||
23 | /** @var NodeVersion $nodeVersion */ |
||
24 | $nodeVersion = $this->createMock(NodeVersion::class); |
||
25 | $page = $this->createMock(HasNodeInterface::class); |
||
26 | |||
27 | $event = new CopyPageTranslationNodeEvent($node, $nodeTranslation, $nodeVersion, $page, $nodeTranslation, $nodeVersion, $page, 'nl'); |
||
0 ignored issues
–
show
|
|||
28 | |||
29 | $this->assertEquals('nl', $event->getOriginalLanguage()); |
||
30 | $this->assertInstanceOf(NodeTranslation::class, $event->getOriginalNodeTranslation()); |
||
31 | $this->assertInstanceOf(\get_class($page), $event->getOriginalPage()); |
||
32 | $this->assertInstanceOf(NodeVersion::class, $event->getOriginalNodeVersion()); |
||
33 | |||
34 | $event->setOriginalLanguage('nl'); |
||
35 | $event->setOriginalNodeTranslation($nodeTranslation); |
||
36 | $event->setOriginalNodeVersion($nodeVersion); |
||
37 | $event->setOriginalPage($page); |
||
0 ignored issues
–
show
$page is of type object<PHPUnit\Framework\MockObject\MockObject> , but the function expects a object<Kunstmaan\NodeBun...ntity\HasNodeInterface> .
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: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
38 | |||
39 | $this->assertEquals('nl', $event->getOriginalLanguage()); |
||
40 | $this->assertInstanceOf(NodeTranslation::class, $event->getOriginalNodeTranslation()); |
||
41 | $this->assertInstanceOf(\get_class($page), $event->getOriginalPage()); |
||
42 | $this->assertInstanceOf(NodeVersion::class, $event->getOriginalNodeVersion()); |
||
43 | } |
||
44 | } |
||
45 |
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: