我在运行单元测试后得到了这个结果。
结果:
1) Tests\Functional\Controllers\Api\UsersControllerTest::testUsersIndex
Unable to find JSON fragment
[[{"email":"FRoAff4@mail.com","id":"706"}]]
within
[{"data":[],"draw":0,"error":"Not Found","recordsFiltered":0,"recordsTotal":1}].
Failed asserting that false is true.
代码:
$this->seeJsonContains([
'id' => $user->id,
'email' => $user->email,
]);
如果在参数中我添加true
它有效。我不明白任务参数是这里的逻辑值(true,false)。
后:
$this->seeJsonContains([
'id' => $user->id,
'email' => $user->email,
], true);