diff --git a/tests/Feature/Recorders/ExceptionsTest.php b/tests/Feature/Recorders/ExceptionsTest.php index f21dbf79..459e22bf 100644 --- a/tests/Feature/Recorders/ExceptionsTest.php +++ b/tests/Feature/Recorders/ExceptionsTest.php @@ -115,16 +115,16 @@ it('can sample', function () { Config::set('pulse.recorders.'.Exceptions::class.'.sample_rate', 0.1); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); expect(Pulse::ingest())->toEqualWithDelta(1, 4); }); @@ -132,16 +132,16 @@ it('can sample at zero', function () { Config::set('pulse.recorders.'.Exceptions::class.'.sample_rate', 0); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); expect(Pulse::ingest())->toBe(0); }); @@ -149,16 +149,16 @@ it('can sample at one', function () { Config::set('pulse.recorders.'.Exceptions::class.'.sample_rate', 1); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); - report(new MyReportedException()); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); + report(new MyReportedException); expect(Pulse::ingest())->toBe(10); }); diff --git a/tests/Feature/Recorders/UserRequestsTest.php b/tests/Feature/Recorders/UserRequestsTest.php index fd848412..3e4a70e7 100644 --- a/tests/Feature/Recorders/UserRequestsTest.php +++ b/tests/Feature/Recorders/UserRequestsTest.php @@ -2,6 +2,7 @@ use Illuminate\Auth\GuardHelpers; use Illuminate\Contracts\Auth\Guard; +use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\DB; @@ -15,6 +16,7 @@ use function Pest\Laravel\post; it('captures authenticated requests', function () { + Carbon::setTestNow('2000-01-02 03:04:05'); Route::get('users', fn () => []); actingAs(User::make(['id' => '567']))->get('users'); @@ -22,7 +24,7 @@ $entries = Pulse::ignore(fn () => DB::table('pulse_entries')->get()); expect($entries)->toHaveCount(1); expect($entries[0])->toHaveProperties([ - 'timestamp' => now()->timestamp, + 'timestamp' => 946782245, 'type' => 'user_request', 'key' => '567', 'value' => null, diff --git a/tests/Feature/RedisTest.php b/tests/Feature/RedisTest.php index 4f2d3fc1..66a5bb0d 100644 --- a/tests/Feature/RedisTest.php +++ b/tests/Feature/RedisTest.php @@ -108,7 +108,7 @@ function prepareForDriver($driver) ->output(); [$firstEntryKey, $lastEntryKey] = collect(explode("\n", $output))->only([17, 21])->values(); - $commands = captureRedisCommands(fn () => $ingest->digest(new StorageFake())); + $commands = captureRedisCommands(fn () => $ingest->digest(new StorageFake)); expect($commands)->toContain('"XRANGE" "laravel_database_laravel:pulse:ingest" "-" "+" "COUNT" "567"'); expect($commands)->toContain('"XDEL" "laravel_database_laravel:pulse:ingest" "'.$firstEntryKey.'" "'.$lastEntryKey.'"'); diff --git a/tests/StorageFake.php b/tests/StorageFake.php index 6f82d4eb..5f9c815f 100644 --- a/tests/StorageFake.php +++ b/tests/StorageFake.php @@ -63,7 +63,7 @@ public function purge(?array $types = null): void */ public function values(string $type, ?array $keys = null): Collection { - return new Collection(); + return new Collection; } /** @@ -74,7 +74,7 @@ public function values(string $type, ?array $keys = null): Collection */ public function graph(array $types, string $aggregate, CarbonInterval $interval): Collection { - return new Collection(); + return new Collection; } /** @@ -97,7 +97,7 @@ public function aggregate( string $direction = 'desc', int $limit = 101, ): Collection { - return new Collection(); + return new Collection; } /** @@ -114,7 +114,7 @@ public function aggregateTypes( string $direction = 'desc', int $limit = 101, ): Collection { - return new Collection(); + return new Collection; } /** @@ -128,6 +128,6 @@ public function aggregateTotal( string $aggregate, CarbonInterval $interval, ): Collection { - return new Collection(); + return new Collection; } }