Skip to content

Commit

Permalink
Use the Hash facade instead of the bcrypt helper
Browse files Browse the repository at this point in the history
  • Loading branch information
DCzajkowski committed Mar 30, 2019
1 parent 0ebbb93 commit 60b0a97
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions src/Console/stubs/tests/Feature/Auth/LoginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(), [
Expand All @@ -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(), [
Expand All @@ -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(), [
Expand Down Expand Up @@ -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 $_) {
Expand Down
6 changes: 3 additions & 3 deletions src/Console/stubs/tests/Feature/Auth/ResetPasswordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(), [
Expand All @@ -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(), [
Expand All @@ -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(), [
Expand Down

0 comments on commit 60b0a97

Please sign in to comment.