From 60b0a97d7bcd5e44c10d03255ac1d0a56388506c Mon Sep 17 00:00:00 2001 From: Dariusz Czajkowski Date: Sat, 30 Mar 2019 05:05:44 +0100 Subject: [PATCH] Use the Hash facade instead of the bcrypt helper --- src/Console/stubs/tests/Feature/Auth/LoginTest.php | 9 +++++---- .../stubs/tests/Feature/Auth/ResetPasswordTest.php | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Console/stubs/tests/Feature/Auth/LoginTest.php b/src/Console/stubs/tests/Feature/Auth/LoginTest.php index a4eeffd..e3ebc81 100644 --- a/src/Console/stubs/tests/Feature/Auth/LoginTest.php +++ b/src/Console/stubs/tests/Feature/Auth/LoginTest.php @@ -5,6 +5,7 @@ use App\User; use Tests\TestCase; use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Hash; use Illuminate\Foundation\Testing\RefreshDatabase; class LoginTest extends TestCase @@ -61,7 +62,7 @@ public function testUserCannotViewALoginFormWhenAuthenticated() public function testUserCanLoginWithCorrectCredentials() { $user = factory(User::class)->create([ - 'password' => bcrypt($password = 'i-love-laravel'), + 'password' => Hash::make($password = 'i-love-laravel'), ]); $response = $this->post($this->loginPostRoute(), [ @@ -77,7 +78,7 @@ public function testRememberMeFunctionality() { $user = factory(User::class)->create([ 'id' => random_int(1, 100), - 'password' => bcrypt($password = 'i-love-laravel'), + 'password' => Hash::make($password = 'i-love-laravel'), ]); $response = $this->post($this->loginPostRoute(), [ @@ -100,7 +101,7 @@ public function testRememberMeFunctionality() public function testUserCannotLoginWithIncorrectPassword() { $user = factory(User::class)->create([ - 'password' => bcrypt('i-love-laravel'), + 'password' => Hash::make('i-love-laravel'), ]); $response = $this->from($this->loginGetRoute())->post($this->loginPostRoute(), [ @@ -150,7 +151,7 @@ public function testUserCannotLogoutWhenNotAuthenticated() public function testUserCannotMakeMoreThanFiveAttemptsInOneMinute() { $user = factory(User::class)->create([ - 'password' => bcrypt($password = 'i-love-laravel'), + 'password' => Hash::make($password = 'i-love-laravel'), ]); foreach (range(0, 5) as $_) { diff --git a/src/Console/stubs/tests/Feature/Auth/ResetPasswordTest.php b/src/Console/stubs/tests/Feature/Auth/ResetPasswordTest.php index a239af9..6d9fa35 100644 --- a/src/Console/stubs/tests/Feature/Auth/ResetPasswordTest.php +++ b/src/Console/stubs/tests/Feature/Auth/ResetPasswordTest.php @@ -88,7 +88,7 @@ public function testUserCanResetPasswordWithValidToken() public function testUserCannotResetPasswordWithInvalidToken() { $user = factory(User::class)->create([ - 'password' => bcrypt('old-password'), + 'password' => Hash::make('old-password'), ]); $response = $this->from($this->passwordResetGetRoute($this->getInvalidToken()))->post($this->passwordResetPostRoute(), [ @@ -107,7 +107,7 @@ public function testUserCannotResetPasswordWithInvalidToken() public function testUserCannotResetPasswordWithoutProvidingANewPassword() { $user = factory(User::class)->create([ - 'password' => bcrypt('old-password'), + 'password' => Hash::make('old-password'), ]); $response = $this->from($this->passwordResetGetRoute($token = $this->getValidToken($user)))->post($this->passwordResetPostRoute(), [ @@ -129,7 +129,7 @@ public function testUserCannotResetPasswordWithoutProvidingANewPassword() public function testUserCannotResetPasswordWithoutProvidingAnEmail() { $user = factory(User::class)->create([ - 'password' => bcrypt('old-password'), + 'password' => Hash::make('old-password'), ]); $response = $this->from($this->passwordResetGetRoute($token = $this->getValidToken($user)))->post($this->passwordResetPostRoute(), [