У меня проблема с этим тестом:
$this->json('POST', 'api/login')
->assertStatus(422)
->assertJson([
'email' => ['The email field is required.'],
'password' => ['The password field is required.'],
]);
И я не понимаю, в чем ошибка:
Unable to find JSON:
[{
"email": [
"The email field is required."
],
"password": [
"The password field is required."
]
}]
within response JSON:
[{
"message": "The given data was invalid.",
"errors": {
"email": [
"The email field is required."
],
"password": [
"The password field is required."
]
}
}].
Failed asserting that an array has the subset Array &0 (
'email' => Array &1 (
0 => 'The email field is required.'
)
'password' => Array &2 (
0 => 'The password field is required.'
)
).
--- Expected
+++ Actual
@@ @@
0 => 'The password field is required.',
),
),
- 'email' =>
- array (
- 0 => 'The email field is required.',
- ),
- 'password' =>
- array (
- 0 => 'The password field is required.',
- ),
)
Кажется, что JSON-утверждение находится в ответе.