Completed
Push — master ( 770316...74fc07 )
by Jeroen
09:08 queued 02:44
created

Tests/unit/Helper/AdminPanel/AdminPanelTest.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\AdminBundle\Tests\Helper\AdminPanel;
4
5
use Kunstmaan\AdminBundle\Helper\AdminPanel\AdminPanel;
6
use Kunstmaan\AdminBundle\Helper\AdminPanel\DefaultAdminPanelAdaptor;
7
use PHPUnit\Framework\TestCase;
8
9
/**
10
 * Class AdminPanelActionTest
11
 */
12
class AdminPanelTest extends TestCase
13
{
14
    public function testAdminPanel()
15
    {
16
        $adapter = $this->createMock(DefaultAdminPanelAdaptor::class);
17
        $adapter->expects($this->once())->method('getAdminPanelActions')->willReturn([]);
18
        $panel = new AdminPanel();
19
        $panel->addAdminPanelAdaptor($adapter);
0 ignored issues
show
$adapter is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Kunstmaan\AdminBu...nPanelAdaptorInterface>.

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...
20
        $actions = $panel->getAdminPanelActions();
21
        $this->assertEmpty($actions);
22
    }
23
}
24