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

NameOfMessage/FromMessageNamedResolverTests.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
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