【发布时间】:2021-08-18 13:24:20
【问题描述】:
目前我正在使用它,它不适用于嵌套的 JSON 文件
public function testitemExists(){
$response = $this->json('GET','/api/items');
$response->assertStatus(200)->assertJsonFragment(['category'=>'drinks']);
}
{
"category" :"drinks",
"items":[{
"item1":"mojito",
"item2":"cocacola"
}
]
}
我如何测试 item1 => mojito 是否存在
【问题讨论】:
标签: php json laravel unit-testing testing