WIP: February 2026 event improvements and calendar refactor #1

Draft
andrew wants to merge 10 commits from feb-2026-event-improvements into master
Showing only changes of commit 9957e8d8a1 - Show all commits

View File

@ -0,0 +1,41 @@
<?php
use App\Models\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\DB;
function createTestUser(array $overrides = []): User
{
return User::forceCreate(array_merge([
'firstname' => 'Test',
'lastname' => 'User',
'displayname' => 'Test User',
'email' => 'test+'.Str::uuid().'@example.com',
'timezone' => 'America/New_York',
'password' => Hash::make('password'),
], $overrides));
}
test('calendar index handles invalid date without error', function () {
$user = createTestUser();
$this->actingAs($user)
->get(route('calendar.index', ['date' => 'not-a-date']))
->assertOk();
});
test('daytime_hours persists to user settings', function () {
$user = createTestUser();
$this->actingAs($user)
->get(route('calendar.index', ['daytime_hours' => 1]))
->assertOk();
$value = DB::table('user_settings')
->where('user_id', $user->id)
->where('key', 'calendar.daytime_hours')
->value('value');
expect($value)->toBe('1');
});