for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Created by PhpStorm.
* User: polidog
* Date: 2016/07/16
*/
namespace Polidog\LaravelBundle\Tests\Controller;
use Phake;
use Polidog\LaravelBundle\Controller\FallbackController;
use Polidog\LaravelBundle\Environment;
use Polidog\LaravelBundle\LaravelKernel;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class FallbackControllerTest extends \PHPUnit_Framework_TestCase
{
* @test
public function callFallback()
$env = Phake::mock(Environment::class);
$laravelKernel = Phake::mock(LaravelKernel::class);
Phake::when($laravelKernel)->handle($this->isInstanceOf(Request::class))
->thenReturn(new \Illuminate\Http\Response());
$controller = new FallbackController($env, $laravelKernel);
$env
object<Phake_IMock>
object<Polidog\LaravelBundle\Environment>
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);
$laravelKernel
object<Polidog\LaravelBundle\LaravelKernel>
$controller->fallback();
Phake::verify($env)->put();
Phake::verify($laravelKernel)->handle($this->isInstanceOf(Request::class));
Phake::verify($laravelKernel)->terminate(
$this->isInstanceOf(Request::class),
$this->isInstanceOf(Response::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: