1
0
Fork 0

tests/Feature/ProfileTest.php: test that user can not set an empty password hash.

This commit is contained in:
Henrik Hautakoski 2021-07-22 18:53:31 +02:00
parent 52f565f04b
commit 099115d613

View file

@ -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'), [