Completed
Push — master ( 7c00aa...d8aae5 )
by Ivannis Suárez
19:41
created

FromMessageNamedResolverTests   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testResolve() 0 19 1
1
<?php
2
/**
3
 * This file is part of the Cubiche package.
4
 *
5
 * Copyright (c) Cubiche
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Cubiche\Core\Bus\Tests\Units\Middlewares\Handler\Resolver\NameOfMessage;
12
13
use Cubiche\Core\Bus\Middlewares\Handler\Resolver\NameOfMessage\FromMessageNamedResolver;
14
use Cubiche\Core\Bus\Tests\Fixtures\Message\LoginUserMessage;
15
use Cubiche\Core\Bus\Tests\Fixtures\Message\LogoutUserMessage;
16
use Cubiche\Core\Bus\Tests\Units\TestCase;
17
18
/**
19
 * FromMessageNamedResolverTests class.
20
 *
21
 * @author Ivannis Suárez Jerez <[email protected]>
22
 */
23
class FromMessageNamedResolverTests extends TestCase
24
{
25
    /**
26
     * Test Resolve method.
27
     */
28
    public function testResolve()
29
    {
30
        $this
31
            ->given($resolver = new FromMessageNamedResolver())
32
            ->when($result = $resolver->resolve(new LogoutUserMessage('[email protected]')))
33
            ->then()
34
                ->string($result)
35
                    ->isEqualTo('logout_user')
36
        ;
37
38
        $this
39
            ->given($resolver = new FromMessageNamedResolver())
40
            ->then()
41
                ->exception(function () use ($resolver) {
42
                    $resolver->resolve(new LoginUserMessage('[email protected]', 'plainpassword'));
0 ignored issues
show
Unused Code introduced by
The call to LoginUserMessage::__construct() has too many arguments starting with 'plainpassword'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
43
                })
44
                ->isInstanceOf(\InvalidArgumentException::class)
45
        ;
46
    }
47
}
48