我在Laravel功能测试中声明JSON response
。
- 答复**
{
"message": "OTP verified successfully",
"phone": "+12312322334",
"route": "dashboard",
"_token": "Some Random Value of Token",
"id": 9
}
这里_token
是动态的,我不知道确切的结果。那么如何处理_token
字段的随机字符串呢?
$response->assertStatus(200)->assertJson([
"message" => "OTP verified successfully",
"phone" => "+12312322334",
"route" => "dashboard",
"_token" => "how to handle here the random dynamic value",
"id" => 9,
]);
1条答案
按热度按时间hmae6n7t1#
因为
_token
这里是一个随机的string
和未知的随机值,所以这里的情况是,我们需要检查该值是string
数据类型。