Merge pull request #218 from copenhagentruckwash/fix-machine-relay-helper-logic

Fix hard MACHINE relay targeting
This commit is contained in:
Jeppe B
2026-06-01 23:11:13 +02:00
committed by GitHub
2 changed files with 15 additions and 1 deletions
@@ -124,7 +124,7 @@ trait selfserve_lane_relay_controller_t
*/
public function setMachineRelayStatusHard(bool $on): bool
{
return $this->setRelayStatusHard(selfserve_lane_relay::MACHINE_PROGRAM_PICKER, $on);
return $this->setRelayStatusHard(selfserve_lane_relay::MACHINE, $on);
}
/**
@@ -332,6 +332,20 @@ it('keeps back-to-back get/switch requests ordered through the relay controller'
expect($harness->shellyCalls[1]['endpoint'])->toBe('/v2/devices/api/set/switch');
});
it('hard MACHINE relay helper targets the configured MACHINE relay', function (): void {
$harness = selfserve_lane_shelly_test_harness();
$result = $harness->setMachineRelayStatusHard(true);
expect($result)->toBeTrue();
expect($harness->getShellyCallCount('/v2/devices/api/set/switch'))->toBe(1);
expect($harness->shellyCalls[0]['payload'])->toMatchArray([
'id' => 'relay-machine',
'channel' => 0,
'on' => true,
]);
});
it('executes sequential switch requests used by wash start and stop flows', function (): void {
$harness = selfserve_lane_shelly_test_harness();