Add selfserve dynamic image sizing config

This commit is contained in:
Jeppe Bundgaard
2026-06-09 12:46:14 +02:00
parent 6446eb2e36
commit fb1f0883e1
7 changed files with 125 additions and 2 deletions
@@ -38,6 +38,28 @@ namespace {
expect($content)->toContain("switch (\$dynamic_image_id)");
});
it('uses the selfserve dynamic image size config for route output and cache keys', function (): void {
$route = file_get_contents(app_path('routes/departmentLanesRoute.php'));
$config = file_get_contents(app_path('modules/selfserve/config/selfserve_dynamic_image_size_c.php'));
$moduleConfig = file_get_contents(app_path('modules/selfserve/selfserve_c.php'));
$imageTrait = file_get_contents(app_path('modules/dynamicimages/traits/dynamicimages_image_t.php'));
expect($route)->not->toBeFalse();
expect($config)->not->toBeFalse();
expect($moduleConfig)->not->toBeFalse();
expect($imageTrait)->not->toBeFalse();
expect($config)->toContain("self::SIZE_ORIGINAL");
expect($config)->toContain("self::SIZE_RELEVANT");
expect($config)->toContain("[self::SIZE_ORIGINAL, self::SIZE_RELEVANT]");
expect($config)->toContain("'dynamic_image_size'");
expect($moduleConfig)->toContain("selfserve_dynamic_image_size_c::class");
expect($moduleConfig)->toContain('public selfserve_dynamic_image_size_c $dynamic_image_size;');
expect($route)->toContain('$dynamic_image_size = self::getSelfServeDynamicImageSizeMode();');
expect($route)->toContain("'dynamic_image_size' => \$dynamic_image_size");
expect($route)->toContain("resizeToMaxWidth(self::RELEVANT_DYNAMIC_IMAGE_MAX_WIDTH)");
expect($imageTrait)->toContain('function resizeToMaxWidth(int $maxWidth)');
});
it('accepts ordered dynamic image button tokens including program picker reset start and zero', function (): void {
expect(department_selfserve_tasks_o::normalizeButtonsInput('["program_picker","reset",0,2,"start",5]'))->toBe([
'program_picker',