Files
api/services/nginx/app/tests/Unit/Selfserve/SelfserveRelayVisibilitySyncWiringTest.php
T
Jeppe Bundgaard 72df2244ca Add self-serve API fixtures and enhance session synchronization logic
- Implement `createSelfServeScenario` to generate comprehensive self-serve test fixtures, including departments, lanes, tasks, and sessions.
- Add `syncRelayState` parameter to `synchronizeSession` for decoupled relay hardware synchronization.
- Update relevant routes and tests to reflect changes in session synchronization methods.
- Enhance Shelly request handling by blocking real device interactions in test mode with detailed logging.
2026-04-28 12:28:29 +02:00

24 lines
1.3 KiB
PHP

<?php
it('synchronizes machine relay from visible services during session synchronization', function (): void {
$washFlow = file_get_contents(app_path('modules/selfserve/classes/selfserve_wash_flow.php'));
expect($washFlow)->not->toBeFalse();
expect($washFlow)->toContain('bool $syncRelayState = true');
expect($washFlow)->toContain('if ($syncRelayState) {');
expect($washFlow)->toContain('$this->syncMachineRelayFromVisibleServices($snapshot, $session, $activateMachine);');
expect($washFlow)->toContain('protected function syncMachineRelayFromVisibleServices');
expect($washFlow)->toContain('$lane->syncMachineRelayFromVisibleServices(');
expect($washFlow)->toContain('$session->markRelayDisabled();');
expect($washFlow)->toContain('$session->updateStatus($this->deriveCurrentStatus($snapshot, $session));');
});
it('adds explicit relay disable session helper for visibility-driven OFF transitions', function (): void {
$sessionsObject = file_get_contents(app_path('objects/selfserve_wash_sessions_o.php'));
expect($sessionsObject)->not->toBeFalse();
expect($sessionsObject)->toContain('public function markRelayDisabled(): void');
expect($sessionsObject)->toContain('$this->machine_relay_enabled->set(false);');
expect($sessionsObject)->toContain('$this->machine_relay_enabled_at->set(null);');
});