laravel8のphpunit testでエラーの意味が分かりません
解決したいこと
laravel8のphpunittestの勉強をしています。
他の箇所ではエラーが出ないのですが、
プロフィールパスワード更新処理のテストでエラーが出て解決策が分かりません。
対応策も合わせて
どなたかご教授下さい。
ソース
/**
* Test Change Password Success
*
* @return void
* @test
*/
public function プロフィールパスワード更新処理()
{
$user = User::factory()->create();
$response = $this->actingAs($user, 'api')
->postJson('/api/change-password', [
'current_password' => 123456,
'new_password' => 123456789,
'confirm_password' => 123456789
]);
// $response->assertStatus(200)
$response->assertJson([
'success' => true,
'message' => true
]);
}
発生している問題・エラー
est --testdox081e:/var/www/html/laravel8# ./vendor/bin/phpunit --filter ProfileTe
PHPUnit 9.5.4 by Sebastian Bergmann and contributors.
Profile (Tests\Feature\Profile)
✔ プロフィールデータ
✔ プロフィールデータ without auth
✔ プロフィールデータ更新
✔ プロフィールデータ更新バリデーションエラー
✘ プロフィールパスワード更新処理
┐
├ Unable to find JSON:
├
├ [{
├ "success": true,
├ "message": true
├ }]
├
├ within response JSON:
├
├ [{
├ "message": "The given data was invalid.",
├ "errors": {
├ "current_password": [
├ "The current password is not match with old password."
├ ]
├ }
├ }].
├
├
├ Failed asserting that an array has the subset Array &0 (
├ 'success' => true
├ 'message' => true
├ ).
┊ ---·Expected
┊ +++·Actual
┊ @@ @@
┊ array (
┊ -··'message'·=>·true,
┊ +··'message'·=>·'The·given·data·was·invalid.',
┊ 'errors' =>
┊ array (
┊ 'current_password' =>
┊ @@ @@
┊ 0 => 'The current password is not match with old password.',
┊ ),
┊ ),
┊ -··'success'·=>·true,
┊ )
│
╵ /var/www/html/laravel8/vendor/laravel/framework/src/Illuminate/Testing/Constraints/ArraySubset.php:85
╵ /var/www/html/laravel8/vendor/laravel/framework/src/Illuminate/Testing/Assert.php:49
╵ /var/www/html/laravel8/vendor/laravel/framework/src/Illuminate/Testing/AssertableJsonString.php:270
╵ /var/www/html/laravel8/vendor/laravel/framework/src/Illuminate/Testing/TestResponse.php:520
╵ /var/www/html/laravel8/tests/Feature/ProfileTest.php:121
┴
✔ プロフィールパスワード更新処理バリデーションエラー
Time: 00:12.008, Memory: 28.00 MB
Summary of non-successful tests:
Profile (Tests\Feature\Profile)
✘ プロフィールパスワード更新処理
┐
├ Unable to find JSON:
├
├ [{
├ "success": true,
├ "message": true
├ }]
├
├ within response JSON:
├
├ [{
├ "message": "The given data was invalid.",
├ "errors": {
├ "current_password": [
├ "The current password is not match with old password."
├ ]
├ }
├ }].
├
├
├ Failed asserting that an array has the subset Array &0 (
├ 'success' => true
├ 'message' => true
├ ).
┊ ---·Expected
┊ +++·Actual
┊ @@ @@
┊ array (
┊ -··'message'·=>·true,
┊ +··'message'·=>·'The·given·data·was·invalid.',
┊ 'errors' =>
┊ array (
┊ 'current_password' =>
┊ @@ @@
┊ 0 => 'The current password is not match with old password.',
┊ ),
┊ ),
┊ -··'success'·=>·true,
┊ )
0