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\Entity\User; |
||
6 | use Kunstmaan\AdminBundle\Helper\AdminPanel\AdminPanelAction; |
||
7 | use Kunstmaan\AdminBundle\Helper\AdminPanel\DefaultAdminPanelAdaptor; |
||
8 | use PHPUnit\Framework\TestCase; |
||
9 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; |
||
10 | use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; |
||
11 | |||
12 | /** |
||
13 | * Class DefaultAdminPanelAdapterTest |
||
14 | */ |
||
15 | class DefaultAdminPanelAdapterTest extends TestCase |
||
16 | { |
||
17 | public function testAdminPanelAdapter() |
||
18 | { |
||
19 | $token = $this->createMock(TokenInterface::class); |
||
20 | $storage = $this->createMock(TokenStorageInterface::class); |
||
21 | $storage->expects($this->once())->method('getToken')->willReturn($token); |
||
22 | $token->expects($this->once())->method('getUser')->willReturn(new User()); |
||
23 | $adapter = new DefaultAdminPanelAdaptor($storage); |
||
0 ignored issues
–
show
|
|||
24 | $actions = $adapter->getAdminPanelActions(); |
||
25 | |||
26 | $this->assertCount(3, $actions); |
||
0 ignored issues
–
show
$actions is of type array<integer,object<Kun...l\\AdminPanelAction>"}> , but the function expects a object<Countable>|object...nit\Framework\iterable> .
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...
|
|||
27 | $this->assertInstanceOf(AdminPanelAction::class, $actions[0]); |
||
28 | $this->assertInstanceOf(AdminPanelAction::class, $actions[1]); |
||
29 | $this->assertInstanceOf(AdminPanelAction::class, $actions[2]); |
||
30 | } |
||
31 | } |
||
32 |
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: