Enable storage-backed key visuals and background images plus service-specific moderator and preacher name overrides. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
53 lines
1.8 KiB
PHP
53 lines
1.8 KiB
PHP
<?php
|
|
|
|
use App\Models\Service;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
beforeEach(function () {
|
|
// Migration rollback is validated via schema assertions; run `ddev exec php artisan migrate:rollback --step=1` manually if needed.
|
|
});
|
|
|
|
test('key visual url returns storage path when filename exists', function () {
|
|
$service = Service::factory()->create([
|
|
'key_visual_filename' => 'slides/a.jpg',
|
|
]);
|
|
|
|
expect($service->keyVisualUrl)->toBe('/storage/slides/a.jpg');
|
|
});
|
|
|
|
test('key visual url returns null when filename is missing', function () {
|
|
$service = Service::factory()->create([
|
|
'key_visual_filename' => null,
|
|
]);
|
|
|
|
expect($service->keyVisualUrl)->toBeNull();
|
|
});
|
|
|
|
test('service fillable persists image and name override columns', function () {
|
|
$service = Service::factory()->create();
|
|
|
|
$service->fill([
|
|
'key_visual_filename' => 'slides/key.jpg',
|
|
'background_filename' => 'slides/background.jpg',
|
|
'moderator_name' => 'Max Mustermann',
|
|
'preacher_name_override' => 'Lisa Beispiel',
|
|
]);
|
|
|
|
$service->save();
|
|
|
|
$fresh = $service->fresh();
|
|
|
|
expect($fresh->key_visual_filename)->toBe('slides/key.jpg')
|
|
->and($fresh->background_filename)->toBe('slides/background.jpg')
|
|
->and($fresh->moderator_name)->toBe('Max Mustermann')
|
|
->and($fresh->preacher_name_override)->toBe('Lisa Beispiel')
|
|
->and($fresh->backgroundUrl)->toBe('/storage/slides/background.jpg');
|
|
});
|
|
|
|
test('services table has the new image and override columns', function () {
|
|
expect(Schema::hasColumn('services', 'key_visual_filename'))->toBeTrue()
|
|
->and(Schema::hasColumn('services', 'background_filename'))->toBeTrue()
|
|
->and(Schema::hasColumn('services', 'moderator_name'))->toBeTrue()
|
|
->and(Schema::hasColumn('services', 'preacher_name_override'))->toBeTrue();
|
|
});
|