我想测试我的字段名称...有人可以解释我如何做这样的事情:
'field'=> '电子邮件'......等等。
我的方法测试
public function testAuthWithoutValidEmail()
{
$this->json('POST', "{$this->baseUrl}/{$this->version}/auth/company",
['email' => 'xpto@xpto', 'password' => '123456'],
['Content-Type' => 'application/json'])
->seeJsonStructure([
'requestTime',
'data' => [
'*' => [
'field',
'rule',
'composed_rule',
'message',
'tag'
]
],
])->seeJson([
'user' => null,
'token' => null
])->assertResponseStatus(\App\Http\Middleware\Constants\HttpStatusCodes::BAD_REQUEST);
}
我的结果json数据:
{ "requestTime": 522,
"data": [
{
"field": "email",
"rule": "Email",
"composed_rule": "Email",
"message": "The email must be a valid email address.",
"tag": "ERROR_FORM_EMAIL_EMAIL"
}
],
"user": null,
"token": null
}