Skip to content

Commit

Permalink
test: adds fake() helper method for Laravel 9
Browse files Browse the repository at this point in the history
`fake()` function does not exists on Laravel 9
  • Loading branch information
joemugen committed Feb 15, 2024
1 parent bc8c9f3 commit 06d8f57
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
]);
}
Expand Down
7 changes: 7 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -61,4 +63,9 @@ protected function getEnvironmentSetUp($app): void
'notification' => ExpoPendingNotificationStorageMysql::class,
]);
}

protected function fake(): Generator
{
return Factory::create();
}
}

0 comments on commit 06d8f57

Please sign in to comment.