Completed
Push — master ( aba493...5356ed )
by Ruud
315:38 queued 305:00
created

Tests/unit/Event/IndexNodeEventTest.php (1 issue)

Upgrade to new PHP Analysis Engine

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\NodeSearchBundle\Event\IndexNodeEvent;
7
use PHPUnit\Framework\TestCase;
8
9
/**
10
 * Class IndexNodeEventTest
11
 */
12
class IndexNodeEventTest extends TestCase
13
{
14
    public function testGetSet()
15
    {
16
        $page = $this->createMock(HasNodeInterface::class);
17
18
        $event = new IndexNodeEvent($page, ['test' => 'value']);
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...
19
20
        $this->assertCount(1, $event->doc);
21
        $this->assertInstanceOf(\get_class($page), $event->getPage());
22
    }
23
}
24