From 06d8f574b8b753d4fd3404f68bc49447c3c3d91b Mon Sep 17 00:00:00 2001 From: Joe FRANCOIS Date: Thu, 15 Feb 2024 15:56:24 +0100 Subject: [PATCH] test: adds fake() helper method for Laravel 9 `fake()` function does not exists on Laravel 9 --- .../Feature/Storage/ExpoPendingNotificationStorageTest.php | 2 +- tests/TestCase.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/Feature/Storage/ExpoPendingNotificationStorageTest.php b/tests/Feature/Storage/ExpoPendingNotificationStorageTest.php index e864d89..bb788d0 100644 --- a/tests/Feature/Storage/ExpoPendingNotificationStorageTest.php +++ b/tests/Feature/Storage/ExpoPendingNotificationStorageTest.php @@ -12,7 +12,7 @@ for ($i = 0; $i < 120; $i++) { ExpoNotification::create([ 'data' => json_encode([ - 'foo' => fake()->slug, + 'foo' => $this->fake()->slug, ], JSON_THROW_ON_ERROR), ]); } diff --git a/tests/TestCase.php b/tests/TestCase.php index 97846e0..14ff86f 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -4,6 +4,8 @@ namespace YieldStudio\LaravelExpoNotifier\Tests; +use Faker\Factory; +use Faker\Generator; use Orchestra\Testbench\TestCase as Orchestra; use YieldStudio\LaravelExpoNotifier\Contracts\ExpoNotificationsServiceInterface; use YieldStudio\LaravelExpoNotifier\Contracts\ExpoPendingNotificationStorageInterface; @@ -61,4 +63,9 @@ protected function getEnvironmentSetUp($app): void 'notification' => ExpoPendingNotificationStorageMysql::class, ]); } + + protected function fake(): Generator + { + return Factory::create(); + } }