Completed
Pull Request — master (#10)
by
unknown
03:16
created

DeleteUserHandlerTest::testUpdateUserGetsHandled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 15
rs 9.4285
cc 1
eloc 8
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
use SumoCoders\FrameworkMultiUserBundle\User\UserRepositoryCollection;
9
10
class DeleteUserHandlerTest extends \PHPUnit_Framework_TestCase
11
{
12
    /**
13
     * @var UserRepository
14
     */
15
    private $userRepository;
16
17
    /**
18
     * @var UserRepositoryCollection
19
     */
20
    private $userRepositoryCollection;
21
22
    public function setUp()
23
    {
24
        $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...
25
        $this->userRepositoryCollection = new UserRepositoryCollection([$this->userRepository]);
26
    }
27
28
    /**
29
     * Test if DeleteUserHandler gets handled.
30
     */
31
    public function testUpdateUserGetsHandled()
32
    {
33
        $handler = new DeleteUserHandler($this->userRepositoryCollection);
34
35
        $deletingUser = $this->userRepository->findByUsername('wouter');
36
37
        $command = new DeleteUser($deletingUser);
38
39
        $handler->handle($command);
40
41
        $this->assertNotNull($deletingUser);
42
        $this->assertNull(
43
            $this->userRepository->findByUsername('wouter')
44
        );
45
    }
46
}
47