Skip to content

Commit

Permalink
test(feature): compare updated password properly
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Dec 3, 2023
1 parent 74d3b31 commit fbcdbec
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions t/Feature/Resource/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public function testPasswordUpdate()
$authenticated_info = $this->makeAuthenticatedInfo();

$faker = Factory::create();
$original_new_password = $faker->password();
$new_password = $faker->password();
$password_data = [
"old_password" => $authenticated_info->getPassword(),
"new_password" => $original_new_password,
"confirm_new_password" => $original_new_password
"new_password" => $new_password,
"confirm_new_password" => $new_password
];

$result = $authenticated_info
Expand All @@ -63,10 +63,11 @@ public function testPasswordUpdate()
$result->assertStatus(204);
$users = model(setting("Auth.userProvider"));
$found_user = $users->findByCredentials([
"email" => $authenticated_info->getUser()->email,
"password" => $original_new_password
"email" => $authenticated_info->getUser()->email
]);
$this->assertNotNull($found_user);
$this->assertSame($found_user->id, $authenticated_info->getUser()->id);
$password_service = service("passwords");
$this->assertTrue($password_service->verify($new_password, $found_user->password_hash));
}
}

0 comments on commit fbcdbec

Please sign in to comment.