Completed
Pull Request — master (#10)
by
unknown
05:39 queued 02:04
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
    /**
12
     * @var UserRepository
13
     */
14
    private $userRepository;
15
16
    public function setUp()
17
    {
18
        $this->userRepository = new InMemoryUserRepository();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \SumoCoders\Framewor...nMemoryUserRepository() of type object<SumoCoders\Framew...InMemoryUserRepository> is incompatible with the declared type object<SumoCoders\Framew...Command\UserRepository> of property $userRepository.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
19
    }
20
21
    /**
22
     * Test if DeleteUserHandler gets handled.
23
     */
24
    public function testUpdateUserGetsHandled()
25
    {
26
        $handler = new DeleteUserHandler($this->userRepository);
27
28
        $deletingUser = $this->userRepository->findByUsername('wouter');
29
30
        $command = new DeleteUser($deletingUser);
31
32
        $handler->handle($command);
33
34
        $this->assertNotNull($deletingUser);
35
        $this->assertNull(
36
            $this->userRepository->findByUsername('wouter')
37
        );
38
    }
39
}
40