/** @test */ public function it_recovers_an_account() { $dbUserRepository = new DbUserRepository(); $user = factory(User::class)->create(); $dbUserRepository->assignCompanyRepresentativeRole($user); $this->visit(route('auth.sign_in'))->click(trans('ahk.forgot_your_password'))->seePageIs(route('auth.recover.get'))->see('<title> ' . trans('ahk.reset_password') . ' · Chamb.Net</title>')->type($user->email, 'email')->press(trans('ahk.send_password_reset_link'))->see(trans('ahk_messages.check_your_email_to_recover_account')); $user = factory(User::class)->create(); $dbUserRepository->assignCompanyRepresentativeRole($user); $dbUserRepository->generateRecoveryToken($user); $this->visit(route('auth.recover.reset', ['slug' => $user->slug, 'recovery_token' => $user->recovery_token]))->seePageIs(route('auth.recover.reset', ['slug' => $user->slug, 'recovery_token' => $user->recovery_token]))->see('<title> ' . trans('ahk.reset_password') . ' · Chamb.Net</title>')->type('new-password', 'password')->type('new-password', 'password_confirmation')->press(trans('ahk.reset_password'))->seePageIs(route('auth.sign_in'))->see(trans('ahk_messages.you_updated_your_accounts_password')); }
/** @test */ public function it_generates_recovery_token() { $dbUserRepository = new DbUserRepository(); $user = factory(User::class)->create(); $oldToken = $user->recovery_token; $user = $dbUserRepository->generateRecoveryToken($user); $this->assertNotEquals($user->token, $oldToken); $this->assertNotNull($user->token); }