From 28a74a37c5153f0380fbc630b0835db9f90739a3 Mon Sep 17 00:00:00 2001 From: Moslem Deris Date: Mon, 28 Oct 2024 13:25:48 +0330 Subject: [PATCH 1/2] refactor deprecated `$this->faker` to laravel `fake()` method --- src/Traits/TestTraits/PhpUnit/TestAuthHelperTrait.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Traits/TestTraits/PhpUnit/TestAuthHelperTrait.php b/src/Traits/TestTraits/PhpUnit/TestAuthHelperTrait.php index 6c757623..b0423a8a 100644 --- a/src/Traits/TestTraits/PhpUnit/TestAuthHelperTrait.php +++ b/src/Traits/TestTraits/PhpUnit/TestAuthHelperTrait.php @@ -109,8 +109,8 @@ private function factoryCreateUser(array|null $userDetails = null): UserModel private function prepareUserDetails(array|null $userDetails = null): array { $defaultUserDetails = [ - 'name' => $this->faker->name, - 'email' => $this->faker->email, + 'name' => fake()->name, + 'email' => fake()->email, 'password' => 'testing-password', ]; @@ -121,7 +121,7 @@ private function prepareUserDetails(array|null $userDetails = null): array private function prepareUserPassword(array|null $userDetails): array|null { // get password from the user details or generate one - $password = $userDetails['password'] ?? $this->faker->password; + $password = $userDetails['password'] ?? fake()->password; // hash the password and set it back at the user details $userDetails['password'] = Hash::make($password); From adea40f884fca4d780e4aefcd29073a4b5eb9407 Mon Sep 17 00:00:00 2001 From: Moslem Deris Date: Mon, 28 Oct 2024 13:25:54 +0330 Subject: [PATCH 2/2] refactor deprecated `$this->faker` to laravel `fake()` method --- tests/Infrastructure/Doubles/BookFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Infrastructure/Doubles/BookFactory.php b/tests/Infrastructure/Doubles/BookFactory.php index d7eb781b..83106e4a 100644 --- a/tests/Infrastructure/Doubles/BookFactory.php +++ b/tests/Infrastructure/Doubles/BookFactory.php @@ -19,7 +19,7 @@ class BookFactory extends CoreFactory public function definition(): array { return [ - 'title' => $this->faker->sentence, + 'title' => fake()->sentence, 'author_id' => UserFactory::new(), ]; }