From 025cb1a0ef4fbd825761aa48147691e2ef4fe17d Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Wed, 19 Jul 2017 16:23:46 +0800 Subject: [PATCH] Passed password reset test --- routes/web/account.php | 4 +-- tests/auth/MemberResetPasswordTest.php | 62 ---------------------------------- tests/auth/ResetPasswordTest.php | 29 ++++++++++++++++ 3 files changed, 31 insertions(+), 64 deletions(-) delete mode 100644 tests/auth/MemberResetPasswordTest.php create mode 100644 tests/auth/ResetPasswordTest.php diff --git a/routes/web/account.php b/routes/web/account.php index 5fc4280..baaf56b 100644 --- a/routes/web/account.php +++ b/routes/web/account.php @@ -18,5 +18,5 @@ Route::group(['middleware' => 'web','as'=>'auth.'], function() { // Password Reset Routes... Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('auth.reset-request'); Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('auth.reset-email'); -Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('auth.reset-password'); -Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('auth.reset-password'); \ No newline at end of file +Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset'); +Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('reset-password'); \ No newline at end of file diff --git a/tests/auth/MemberResetPasswordTest.php b/tests/auth/MemberResetPasswordTest.php deleted file mode 100644 index ea2958c..0000000 --- a/tests/auth/MemberResetPasswordTest.php +++ /dev/null @@ -1,62 +0,0 @@ -create(); - - // // Reset Request - // $this->visit(route('auth.reset-request')); - // $this->notSeeInDatabase('password_resets', [ - // 'email' => $user->email - // ]); - // $this->see('Reset Password'); - // $this->type($user->email,'email'); - // $this->press('Kirim Link Reset Password'); - // $this->seePageIs(route('auth.reset-request')); - // $this->see('Kami sudah mengirim email'); - // $this->seeInDatabase('password_resets', [ - // 'email' => $user->email - // ]); - - // // Reset Action - // $resetData = DB::table('password_resets')->where('email', $user->email)->first(); - // $token = $resetData->token; - - // $this->visit('password/reset/' . $token); - // $this->see('Reset Password'); - // $this->see('Password Baru'); - - // // Enter an invalid email - // $this->type('mail@mail.com','email'); - // $this->type('rahasia','password'); - // $this->type('rahasia','password_confirmation'); - // $this->press('Reset Password'); - // $this->see('Kami tidak dapat menemukan pengguna dengan email tersebut'); - - // // Enter a valid email - // $this->type($user->email,'email'); - // $this->type('rahasia','password'); - // $this->type('rahasia','password_confirmation'); - // $this->press('Reset Password'); - - // $this->seePageIs(route('home')); - - // $this->notSeeInDatabase('password_resets', [ - // 'email' => $user->email - // ]); - - // // Logout and login using new Password - // $this->click('Keluar'); - // $this->seePageIs(route('auth.login')); - // $this->type($user->username,'username'); - // $this->type('rahasia','password'); - // $this->press('Login'); - // $this->seePageIs(route('home')); - } - -} diff --git a/tests/auth/ResetPasswordTest.php b/tests/auth/ResetPasswordTest.php new file mode 100644 index 0000000..d44e214 --- /dev/null +++ b/tests/auth/ResetPasswordTest.php @@ -0,0 +1,29 @@ +create(); + $user1 = factory(User::class)->create(['username' => '123456', 'email' => 'testing@app.dev']); + + // Reset Request + $this->visit('password/reset'); + $this->notSeeInDatabase('password_resets', [ + 'email' => 'testing@app.dev' + ]); + $this->see(trans('auth.reset_password')); + $this->type('testing@app.dev','email'); + $this->press(trans('auth.send_reset_password_link')); + $this->seePageIs('password/reset'); + $this->see(trans('passwords.sent')); + $this->seeInDatabase('password_resets', [ + 'email' => 'testing@app.dev' + ]); + + } + +}