Laravel 5 PHPUnit - Invalid JSON was returned from the route Laravel 5 PHPUnit - Invalid JSON was returned from the route laravel laravel

Laravel 5 PHPUnit - Invalid JSON was returned from the route


The problem is the CSRF Token.

You could disable the middleware by using the WithoutMiddleware trait:

<?phpuse Illuminate\Foundation\Testing\WithoutMiddleware;class ExampleTest extends TestCase{    use WithoutMiddleware;    //}

Or, if you would like to only disable middleware for a few test methods, you may call the withoutMiddleware method from within the test methods:

<?phpclass ExampleTest extends TestCase{    /**     * A basic functional test example.     *     * @return void     */    public function testBasicExample()    {        $this->withoutMiddleware();        $this->visit('/')             ->see('Laravel 5');    }}