laravel从路由返回无效的JSON。也许抛出异常?

时间:2017-05-14 11:27:07

标签: php json unit-testing testing laravel-5.1

这是我对商店功能的测试

/** @test */
public function storeTest()
{
    $this->be($this->user);
    $response = $this->json('POST', '/client/ocp/profile/247/route-', [
        'name'       => 'Test store',
        'speed'      => 4.5,
        'created_by' => $this->user->id,
        'client_id'  => '262',

    ]);
    $response
        ->seeStatusCode(302)
        ->seeJson(['status' => 'OK']);

}

当我运行它时出现此错误

Invalid JSON was returned from the route. Perhaps an exception was thrown?

我尝试添加此标题以解决问题 [' X-请求-随着' => ' XMLHttpRequest的'] 但它没有解决

我怎么能解决这个问题?

0 个答案:

没有答案