Completed
Pull Request — master (#10)
by
unknown
02:53
created

DeleteUserHandlerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 4
Bugs 1 Features 2
Metric Value
wmc 2
c 4
b 1
f 2
lcom 1
cbo 4
dl 0
loc 31
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testUpdateUserGetsHandled() 0 15 1
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