'on', 'Off' => 'off') as $command => $want) { $sent = array(); $_REQUEST = array('action' => 'device', 'command' => $command, 'key' => 'A1'); try { include __DIR__.'/../../web/ajax/device.php'; } catch (StopRequest $e) { } if ($sent === array(array('A1', $want))) { echo "ok - $command is sent to zmx10 as $want\n"; } else { $failures++; echo "FAIL - $command sent as ".var_export($sent, true)."\n"; } } exit($failures ? 1 : 0); }