getMessage(); } catch (Throwable $e) { return get_class($e).': '.$e->getMessage(); } return null; } foreach (array('device.php' => 'error: Unrecognised action ', 'devices.php' => 'error: Unrecognised action ""') as $file => $want) { check("$file: an array action is an unrecognised action", run($root, $file, array('action' => array('x'))), $want); check("$file: a nested array action is an unrecognised action", run($root, $file, array('action' => array(array('x')))), $want); } check('devices.php: action=delete still deletes', run($root, 'devices.php', array('action' => 'delete', 'markDids' => array('3', '4'))), 'ok'); check('devices.php: action=delete ran a DELETE per id', count($GLOBALS['db_calls']), 2); check('device.php: a command still reaches the X10 helper', run($root, 'device.php', array('action' => 'device', 'command' => 'On', 'key' => 'A1')), 'ok'); check('device.php: an array command is refused, not a TypeError', run($root, 'device.php', array('action' => 'device', 'command' => array('x'), 'key' => 'A1')), 'error: No response from X10 device A1'); exit($failures ? 1 : 0); }