Add reusable routes for department self-serve machine types, n8n workflows, and executions, with corresponding unit tests and service integration.

This commit is contained in:
Jeppe Bundgaard
2026-03-16 11:36:48 +01:00
parent ca573783d2
commit d890d589ff
48 changed files with 4812 additions and 356 deletions
@@ -0,0 +1,43 @@
<?php
function selfserve_openapi_content_or_skip(): string
{
$candidates = [
dirname(__DIR__, 4) . DIRECTORY_SEPARATOR . 'openapi.yaml',
dirname(__DIR__, 3) . DIRECTORY_SEPARATOR . 'openapi.yaml',
dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'openapi.yaml',
];
foreach ($candidates as $candidate) {
if (!is_file($candidate)) {
continue;
}
$content = file_get_contents($candidate);
if ($content !== false) {
return $content;
}
}
test()->markTestSkipped('openapi.yaml is not available in this runtime environment.');
}
it('documents self-serve machine type, eligibility, summary, and webhook endpoints', function (): void {
$content = selfserve_openapi_content_or_skip();
expect($content)->toContain('/department/selfserve/machine-types:');
expect($content)->toContain('/department/selfserve/vehicle/allowed:');
expect($content)->toContain('/department/selfserve/washes/summary:');
expect($content)->toContain('/relay/button/press/post:');
});
it('defines reusable self-serve wash and machine type schemas', function (): void {
$content = selfserve_openapi_content_or_skip();
expect($content)->toContain('SelfserveMachineType:');
expect($content)->toContain('SelfserveVehicleAllowedResponse:');
expect($content)->toContain('SelfserveWashSummary:');
expect($content)->toContain('MachineButtonPressWebhookResponse:');
expect($content)->toContain('DepartmentSelfserveVehicleConditionMutationResponse:');
expect($content)->toContain('machine_type_id:');
});