Files
api/services/nginx/app/tests/Unit/Selfserve/SelfserveSchemaBootstrapCompatibilityTest.php
T
Jeppe Bundgaard eeccacb2a7 Add unit tests for department lane dynamic image overrides and introduce classes for self-serve signal and virtual hardware management
- Add `DepartmentLaneDynamicImageRouteTest` to verify dynamic image preview handling for studio lanes.
- Introduce `selfserve_machine_signal` class to standardize signal normalization, recording, and gateway signal management workflows.
- Add `selfserve_virtual_hardware` class to handle virtual hardware configurations, including gateway and binding management.
- Enhance structure with auxiliary methods for payload normalization, workspace merging, and validation warnings.
2026-04-29 09:52:51 +02:00

44 lines
2.4 KiB
PHP

<?php
it('adds dynamic_images_vehicle_type column for legacy selfserve wash session task schemas', function (): void {
$bootstrapContent = file_get_contents(app_path('classes/selfserve_schema_bootstrap.php'));
expect($bootstrapContent)->not->toBeFalse();
expect($bootstrapContent)->toContain("'selfserve_wash_session_tasks'");
expect($bootstrapContent)->toContain("'dynamic_images_vehicle_type'");
expect($bootstrapContent)->toContain('ALTER TABLE selfserve_wash_session_tasks ADD COLUMN dynamic_images_vehicle_type INT NULL AFTER buttons');
});
it('adds wash_started_at column for legacy selfserve wash session schemas', function (): void {
$bootstrapContent = file_get_contents(app_path('classes/selfserve_schema_bootstrap.php'));
expect($bootstrapContent)->not->toBeFalse();
expect($bootstrapContent)->toContain("'selfserve_wash_sessions'");
expect($bootstrapContent)->toContain("'wash_started_at'");
expect($bootstrapContent)->toContain('ALTER TABLE selfserve_wash_sessions ADD COLUMN wash_started_at DATETIME NULL AFTER machine_start_triggered_at');
});
it('creates canvas-only self-serve studio layout storage', function (): void {
$bootstrapContent = file_get_contents(app_path('classes/selfserve_schema_bootstrap.php'));
expect($bootstrapContent)->not->toBeFalse();
expect($bootstrapContent)->toContain('CREATE TABLE IF NOT EXISTS department_selfserve_studio_layouts');
expect($bootstrapContent)->toContain('layout_json JSON NOT NULL');
expect($bootstrapContent)->toContain('idx_department_selfserve_studio_layouts_department_user');
});
it('uses mysql-safe identifiers for self-serve studio virtual hardware storage', function (): void {
$bootstrapContent = file_get_contents(app_path('classes/selfserve_schema_bootstrap.php'));
expect($bootstrapContent)->not->toBeFalse();
expect($bootstrapContent)->toContain('CREATE TABLE IF NOT EXISTS department_selfserve_studio_virtual_hardware');
expect($bootstrapContent)->toContain('UNIQUE KEY uniq_selfserve_vhw_department');
expect($bootstrapContent)->toContain('INDEX idx_selfserve_vhw_dept_updated');
expect($bootstrapContent)->not->toContain('idx_department_selfserve_studio_virtual_hardware_department_updated');
preg_match_all('/\b(?:UNIQUE\s+KEY|INDEX)\s+([a-zA-Z0-9_]+)/', $bootstrapContent, $matches);
foreach ($matches[1] as $identifier) {
expect(strlen($identifier))->toBeLessThanOrEqual(64);
}
});