cubiche /
bus
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * This file is part of the Cubiche package. |
||
| 5 | * |
||
| 6 | * Copyright (c) Cubiche |
||
| 7 | * |
||
| 8 | * For the full copyright and license information, please view the LICENSE |
||
| 9 | * file that was distributed with this source code. |
||
| 10 | */ |
||
| 11 | |||
| 12 | namespace Cubiche\Core\Bus\Tests\Units\Middlewares\Handler\Resolver\HandlerMethodName; |
||
| 13 | |||
| 14 | use Cubiche\Core\Bus\Exception\NotFoundException; |
||
| 15 | use Cubiche\Core\Bus\Middlewares\Handler\Resolver\HandlerMethodName\ChainResolver; |
||
| 16 | use Cubiche\Core\Bus\Middlewares\Handler\Resolver\HandlerMethodName\DefaultResolver; |
||
| 17 | use Cubiche\Core\Bus\Middlewares\Handler\Resolver\HandlerMethodName\MethodWithShortObjectNameResolver; |
||
| 18 | use Cubiche\Core\Bus\Tests\Fixtures\Message\LoginUserMessage; |
||
| 19 | use Cubiche\Core\Bus\Tests\Fixtures\Message\LogoutUserMessage; |
||
| 20 | use Cubiche\Core\Bus\Tests\Fixtures\InvalidHandlerMethodNameResolver; |
||
| 21 | use Cubiche\Core\Bus\Tests\Units\TestCase; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * ChainResolver class. |
||
| 25 | * |
||
| 26 | * Generated by TestGenerator on 2016-04-07 at 15:40:41. |
||
| 27 | */ |
||
| 28 | class ChainResolverTests extends TestCase |
||
| 29 | { |
||
| 30 | /** |
||
| 31 | * Test Resolve method. |
||
| 32 | */ |
||
| 33 | public function testResolve() |
||
| 34 | { |
||
| 35 | $this |
||
| 36 | ->given($resolver1 = new InvalidHandlerMethodNameResolver()) |
||
| 37 | ->given($resolver2 = new MethodWithShortObjectNameResolver('Message')) |
||
| 38 | ->and($resolver3 = new DefaultResolver()) |
||
| 39 | ->and($resolver = new ChainResolver([$resolver1, $resolver2, $resolver3])) |
||
| 40 | ->when($result = $resolver->resolve(LoginUserMessage::class)) |
||
| 41 | ->then() |
||
| 42 | ->string($result) |
||
| 43 | ->isEqualTo('loginUser') |
||
| 44 | ; |
||
| 45 | |||
| 46 | $this |
||
| 47 | ->given($resolver = new ChainResolver([])) |
||
| 48 | ->then() |
||
| 49 | ->exception(function () use ($resolver) { |
||
| 50 | $resolver->resolve(new LogoutUserMessage('[email protected]')); |
||
|
0 ignored issues
–
show
|
|||
| 51 | }) |
||
| 52 | ->isInstanceOf(NotFoundException::class) |
||
| 53 | ; |
||
| 54 | } |
||
| 55 | } |
||
| 56 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: