diff --git a/tests/Feature/ProfileTest.php b/tests/Feature/ProfileTest.php index f0c45f0..b13ffc2 100644 --- a/tests/Feature/ProfileTest.php +++ b/tests/Feature/ProfileTest.php @@ -85,6 +85,26 @@ class ProfileTest extends TestCase ]); } + public function test_user_can_not_set_empty_password_hash() + { + $user = User::factory()->create([ 'password' => NULL ]); + + $response = $this->actingAs($user) + ->post(route('profile.update'), [ + 'username' => $user->username, + 'current_password' => '', + 'password' => '', + 'password_confirmation' => '' + ]); + + $response->assertRedirect(route('profile.index')); + + $this->assertDatabaseHas('users', [ + 'id' => $user->id, + 'password' => NULL + ]); + } + public function test_guest_can_not_update() { $response = $this->post(route('profile.update'), [