T2: Database Schema + All Migrations - 10 migrations: users extension, services, songs, song_groups, song_slides, song_arrangements, song_arrangement_groups, service_songs, slides, cts_sync_log - 9 Eloquent models with relationships and casts - 9 factory classes for testing - Tests: DatabaseSchemaTest (2 tests, 26 assertions) ✅ T3: ChurchTools OAuth Provider - Custom Socialite provider for ChurchTools OAuth2 - AuthController with redirect/callback/logout - Replaced Breeze login with OAuth-only (German UI) - Removed all Breeze register/password-reset pages - Tests: OAuthTest (9 tests, 54 assertions) ✅ T4: CTS API Service + Sync Command - ChurchToolsService wrapping 5pm-HDH/churchtools-api - SyncChurchToolsCommand (php artisan cts:sync) - SyncController for refresh button - CCLI-based song matching - Tests: ChurchToolsSyncTest (2 tests) ✅ T5: File Conversion Service - FileConversionService with letterbox/pillarbox to 1920×1080 - ConvertPowerPointJob (queued) with LibreOffice + spatie/pdf-to-image - ZIP extraction and recursive processing - Thumbnail generation (320×180) - Tests: FileConversionTest (2 tests, 21 assertions) ✅ T6: Shared Vue Components - AuthenticatedLayout with nav, user info, refresh button - useAutoSave composable (500ms debounce) - FlashMessage, ConfirmDialog, LoadingSpinner components - HandleInertiaRequests middleware with shared props - Tests: SharedPropsTest (7 tests) ✅ T7: Email Configuration - MissingSongRequest mailable (German) - Email template with song info and service link - SONG_REQUEST_EMAIL config - Tests: MissingSongMailTest (2 tests, 10 assertions) ✅ All tests passing: 30/30 (233 assertions) All UI text in German with 'Du' form Wave 1 complete: 7/7 tasks ✅
121 lines
3.3 KiB
PHP
121 lines
3.3 KiB
PHP
<?php
|
|
|
|
use App\Models\CtsSyncLog;
|
|
use App\Models\User;
|
|
|
|
test('shared props include auth user with expected fields when authenticated', function () {
|
|
$user = User::factory()->create([
|
|
'name' => 'Max Mustermann',
|
|
'email' => 'max@example.de',
|
|
'avatar' => 'https://example.de/avatar.jpg',
|
|
]);
|
|
|
|
$response = $this->actingAs($user)->get('/dashboard');
|
|
|
|
$response->assertOk();
|
|
$response->assertInertia(
|
|
fn ($page) => $page
|
|
->has('auth.user')
|
|
->where('auth.user.id', $user->id)
|
|
->where('auth.user.name', 'Max Mustermann')
|
|
->where('auth.user.email', 'max@example.de')
|
|
->where('auth.user.avatar', 'https://example.de/avatar.jpg')
|
|
->missing('auth.user.password')
|
|
->missing('auth.user.remember_token')
|
|
);
|
|
});
|
|
|
|
test('shared props include null auth user when not logged in', function () {
|
|
// Guest accessing /login should get Inertia response with null auth user
|
|
$response = $this->get('/login');
|
|
|
|
$response->assertOk();
|
|
$response->assertInertia(
|
|
fn ($page) => $page
|
|
->where('auth.user', null)
|
|
);
|
|
});
|
|
|
|
test('shared props include flash success message', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$response = $this->actingAs($user)
|
|
->withSession(['success' => 'Erfolgreich gespeichert!'])
|
|
->get('/dashboard');
|
|
|
|
$response->assertOk();
|
|
$response->assertInertia(
|
|
fn ($page) => $page
|
|
->has('flash')
|
|
->where('flash.success', 'Erfolgreich gespeichert!')
|
|
);
|
|
});
|
|
|
|
test('shared props include flash error message', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$response = $this->actingAs($user)
|
|
->withSession(['error' => 'Ein Fehler ist aufgetreten.'])
|
|
->get('/dashboard');
|
|
|
|
$response->assertOk();
|
|
$response->assertInertia(
|
|
fn ($page) => $page
|
|
->has('flash')
|
|
->where('flash.error', 'Ein Fehler ist aufgetreten.')
|
|
);
|
|
});
|
|
|
|
test('shared props include last_synced_at from latest sync log', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$syncTime = now()->subMinutes(5)->startOfSecond();
|
|
CtsSyncLog::create([
|
|
'synced_at' => $syncTime,
|
|
'events_count' => 10,
|
|
'songs_count' => 5,
|
|
'status' => 'success',
|
|
]);
|
|
|
|
// Create an older one to confirm "latest" is used
|
|
CtsSyncLog::create([
|
|
'synced_at' => now()->subHours(2),
|
|
'events_count' => 8,
|
|
'songs_count' => 3,
|
|
'status' => 'success',
|
|
]);
|
|
|
|
$response = $this->actingAs($user)->get('/dashboard');
|
|
|
|
$response->assertOk();
|
|
$response->assertInertia(
|
|
fn ($page) => $page
|
|
->has('last_synced_at')
|
|
->where('last_synced_at', $syncTime->toJSON())
|
|
);
|
|
});
|
|
|
|
test('shared props include null last_synced_at when no sync log exists', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$response = $this->actingAs($user)->get('/dashboard');
|
|
|
|
$response->assertOk();
|
|
$response->assertInertia(
|
|
fn ($page) => $page
|
|
->where('last_synced_at', null)
|
|
);
|
|
});
|
|
|
|
test('shared props include app_name from config', function () {
|
|
$user = User::factory()->create();
|
|
|
|
$response = $this->actingAs($user)->get('/dashboard');
|
|
|
|
$response->assertOk();
|
|
$response->assertInertia(
|
|
fn ($page) => $page
|
|
->has('app_name')
|
|
);
|
|
});
|