Completed
Pull Request — master (#10)
by
unknown
04:15 queued 01:18
created

DeleteUserHandlerTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace SumoCoders\FrameworkMultiUserBundle\Tests\Command;
4
5
use SumoCoders\FrameworkMultiUserBundle\Command\DeleteUser;
6
use SumoCoders\FrameworkMultiUserBundle\Command\DeleteUserHandler;
7
use SumoCoders\FrameworkMultiUserBundle\User\InMemoryUserRepository;
8
9
class DeleteUserHandlerTest extends \PHPUnit_Framework_TestCase
10
{
11
    private $userRepository;
12
13
    public function setUp()
14
    {
15
        $this->userRepository = new InMemoryUserRepository();
16
    }
17
18
    /**
19
     * Test if DeleteUserHandler gets handled.
20
     */
21
    public function testUpdateUserGetsHandled()
22
    {
23
        $handler = new DeleteUserHandler($this->userRepository);
24
25
        $deletingUser = $this->userRepository->findByUsername('wouter');
26
27
        $command = new DeleteUser($deletingUser);
0 ignored issues
show
Documentation introduced by
$deletingUser is of type object<Symfony\Component...ser\UserInterface>|null, but the function expects a object<SumoCoders\Framew...tiUserBundle\User\User>.

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...
28
29
        $handler->handle($command);
30
31
        $this->assertNotNull($deletingUser);
32
        $this->assertNull(
33
            $this->userRepository->findByUsername('wouter')
34
        );
35
    }
36
}
37