for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the Cubiche package.
*
* Copyright (c) Cubiche
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cubiche\Core\Bus\Tests\Units\Middlewares\Handler\Resolver\HandlerMethodName;
use Cubiche\Core\Bus\Exception\NotFoundException;
use Cubiche\Core\Bus\Middlewares\Handler\Resolver\HandlerMethodName\ChainResolver;
use Cubiche\Core\Bus\Middlewares\Handler\Resolver\HandlerMethodName\DefaultResolver;
use Cubiche\Core\Bus\Middlewares\Handler\Resolver\HandlerMethodName\MethodWithShortObjectNameResolver;
use Cubiche\Core\Bus\Tests\Fixtures\Message\LoginUserMessage;
use Cubiche\Core\Bus\Tests\Fixtures\Message\LogoutUserMessage;
use Cubiche\Core\Bus\Tests\Fixtures\InvalidHandlerMethodNameResolver;
use Cubiche\Core\Bus\Tests\Units\TestCase;
* ChainResolver class.
* Generated by TestGenerator on 2016-04-07 at 15:40:41.
class ChainResolverTests extends TestCase
{
* Test Resolve method.
public function testResolve()
$this
->given($resolver1 = new InvalidHandlerMethodNameResolver())
->given($resolver2 = new MethodWithShortObjectNameResolver('Message'))
->and($resolver3 = new DefaultResolver())
->and($resolver = new ChainResolver([$resolver1, $resolver2, $resolver3]))
->when($result = $resolver->resolve(LoginUserMessage::class))
->then()
->string($result)
->isEqualTo('loginUser')
;
->given($resolver = new ChainResolver([]))
->exception(function () use ($resolver) {
$resolver->resolve(new LogoutUserMessage('[email protected]'));
new \Cubiche\Core\Bus\Te...age('[email protected]')
object<Cubiche\Core\Bus\...sage\LogoutUserMessage>
string
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:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
})
->isInstanceOf(NotFoundException::class)
}
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: