[10.x] Update fixture hash to match testing cost (#6259)

* Update fixture hash to match testing cost

* Conditionally use lower cost in tests

* use hash facade and memoize

* remove import

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
This commit is contained in:
Tim MacDonald 2023-10-25 01:11:07 +11:00 committed by GitHub
parent 036ea83da2
commit 7fe97a165a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
@ -10,6 +11,8 @@ use Illuminate\Support\Str;
*/
class UserFactory extends Factory
{
protected static ?string $password;
/**
* Define the model's default state.
*
@ -21,7 +24,7 @@ class UserFactory extends Factory
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => '$2y$12$Z/vhVO3e.UXKaG11EWgxc.EL7uej3Pi1M0Pq0orF5cbFGtyVh0V3C', // password
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}