Add Bird gate call flow unit tests, self-serve machine wash minutes config, relay sync improvements, and OpenAPI updates. Refactor Bird call handling with terminal status detection and timeout normalization.

This commit is contained in:
Jeppe Bundgaard
2026-03-26 13:16:18 +01:00
parent a4654398d0
commit 95063d2a70
20 changed files with 731 additions and 77 deletions
@@ -53,6 +53,7 @@ class SelfserveLaneStopFlowHarness
public int $id = 77;
public object $department_lane;
public int $invoiceCalls = 0;
public int $ensureInvoiceOrderContextCalls = 0;
public int $vehicleTypeProductAddCalls = 0;
/** @var selfserve_lane_port[] */
public array $openedPorts = [];
@@ -147,6 +148,12 @@ class SelfserveLaneStopFlowHarness
return true;
}
public function ensureInvoiceOrderContextForVehicleProduct(): bool
{
$this->ensureInvoiceOrderContextCalls++;
return true;
}
public function addVehicleTypeProductToLastInvoiceOrder(): bool
{
$this->vehicleTypeProductAddCalls++;
@@ -170,6 +177,14 @@ class SelfserveLaneStopFlowHarness
return true;
}
public function setRelayStatusHard(selfserve_lane_relay $relay, bool $on, ?int $toggle_after = null): bool
{
if ($on === false) {
$this->turnedOffRelays[] = $relay;
}
return true;
}
public function logLaneAction(...$args): void {}
protected function completeLatestSessionForStop(): void
@@ -185,12 +200,13 @@ it('adds vehicle type product on STOP when program selector is on, then turns of
$lane->execute(selfserve_lane_command::STOP, $args);
expect($lane->invoiceCalls)->toBe(1);
expect($lane->ensureInvoiceOrderContextCalls)->toBe(1);
expect($lane->vehicleTypeProductAddCalls)->toBe(1);
expect($lane->openedPorts)->toBe([selfserve_lane_port::EXIT]);
expect($lane->turnedOffRelays)->toBe([
selfserve_lane_relay::MACHINE_CLEANER,
selfserve_lane_relay::MACHINE,
selfserve_lane_relay::MACHINE_PROGRAM_PICKER,
selfserve_lane_relay::MACHINE,
]);
expect($lane->getLaneStatus())->toBe(selfserve_lane_status::AVAILABLE);
});
@@ -207,9 +223,10 @@ it('skips vehicle type product add when program selector is off and only disable
$lane->execute(selfserve_lane_command::STOP, $args);
expect($lane->invoiceCalls)->toBe(1);
expect($lane->ensureInvoiceOrderContextCalls)->toBe(0);
expect($lane->vehicleTypeProductAddCalls)->toBe(0);
expect($lane->turnedOffRelays)->toBe([
selfserve_lane_relay::MACHINE,
selfserve_lane_relay::MACHINE_PROGRAM_PICKER,
selfserve_lane_relay::MACHINE,
]);
});