Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** @test */
- public function security_can_reset_password()
- {
- Notification::fake();
- $this->post('api/security/reset', ['email' => 'test@testy.tt'])
- ->assertResponseOk()
- ->seeJson([
- 'success' => true,
- 'error' => false
- ]);
- $token = DB::table('password_resets')
- ->where('email', 'test@testy.tt')
- ->orderBy('id', 'desc')
- ->value('token');
- Notification::assertSentTo(
- $this->security,
- ResetPassword::class,
- function ($notification, $channels) use ($token) {
- return $notification->token === $token;
- }
- );
- $this->post('api/security/resetting', [
- 'email' => 'test@testy.tt',
- 'token' => $token,
- 'password' => '87538753',
- 'password_confirmation' => '87538753'
- ])
- ->assertResponseOk()
- ->seeJson([
- 'success' => true,
- 'error' => false
- ]);
- $newHashedPassword = Security::whereEmail('test@testy.tt')->value('password');
- $this->assertTrue(Hash::check('87538753', $newHashedPassword));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement