From 34e70fc427d2a7bbd3d83ad69cb07f1ac44226e4 Mon Sep 17 00:00:00 2001 From: Valentin Sickert <17144397+Lapotor@users.noreply.github.com> Date: Wed, 13 Dec 2023 19:50:10 +0100 Subject: [PATCH] change update test Signed-off-by: Valentin Sickert <17144397+Lapotor@users.noreply.github.com> --- tests/Feature/Http/Controllers/UserControllerTest.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/Feature/Http/Controllers/UserControllerTest.php b/tests/Feature/Http/Controllers/UserControllerTest.php index 947800ce..a706a7b4 100644 --- a/tests/Feature/Http/Controllers/UserControllerTest.php +++ b/tests/Feature/Http/Controllers/UserControllerTest.php @@ -105,16 +105,19 @@ public function test_users_update(): void 'email' => 'updated.email@example.com', ]; - $newUserData = array_merge($user->toArray(), $userData); - // Send a PATCH request to the update endpoint $response = $this->put('/api/v1/users/' . $user->id, $userData); // Assert that the response has a successful status code $response->assertStatus(200); + $this->assertDatabaseHas('users', [ + 'name' => $userData['name'], + 'email' => $userData['email'], + ]); + // Assert that the response contains the updated user data - $response->assertJsonFragment($newUserData); + $response->assertJsonFragment($userData); } /**