25 lines
697 B
PHP
25 lines
697 B
PHP
<?php
|
|
|
|
use App\Models\AuditLogEntry;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
it('formats created_at timestamp in Chicago timezone', function () {
|
|
Carbon::setTestNow('2024-01-01 12:00:00');
|
|
|
|
$entry = AuditLogEntry::create([
|
|
'user' => 'test@example.com',
|
|
'ip_address' => '127.0.0.1',
|
|
'message' => 'Test Message',
|
|
'affected' => ['users' => [1]],
|
|
]);
|
|
|
|
// Force reload to trigger the attribute accessor
|
|
$entry->refresh();
|
|
|
|
// The timestamp should be formatted as "M j, Y H:i:s" in America/Chicago timezone
|
|
expect($entry->created_at)->toBe('Jan 1, 2024 06:00:00');
|
|
});
|