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\EventListener; |
||
4 | |||
5 | use FOS\UserBundle\Event\FilterUserResponseEvent; |
||
6 | use FOS\UserBundle\Model\UserManager; |
||
7 | use Kunstmaan\AdminBundle\Entity\User; |
||
8 | use Kunstmaan\AdminBundle\EventListener\PasswordResettingListener; |
||
9 | use PHPUnit\Framework\TestCase; |
||
10 | |||
11 | class PasswordResettingListenerTest extends TestCase |
||
12 | { |
||
13 | public function testListener() |
||
14 | { |
||
15 | $manager = $this->createMock(UserManager::class); |
||
16 | $user = $this->createMock(User::class); |
||
17 | |||
18 | $manager->expects($this->once())->method('updateUser')->willReturn(true); |
||
19 | $user->expects($this->once())->method('setPasswordChanged')->willReturn(true); |
||
20 | |||
21 | $event = $this->createMock(FilterUserResponseEvent::class); |
||
22 | $event->expects($this->any())->method('getUser')->willReturn($user); |
||
23 | |||
24 | $listener = new PasswordResettingListener($manager); |
||
0 ignored issues
–
show
|
|||
25 | $listener->onPasswordResettingSuccess($event); |
||
0 ignored issues
–
show
$event is of type object<PHPUnit\Framework\MockObject\MockObject> , but the function expects a object<FOS\UserBundle\Ev...ilterUserResponseEvent> .
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...
|
|||
26 | } |
||
27 | } |
||
28 |
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: