id = $id; $m->data = array('Monitor' => $data); AppModel::$stored = $stored; return $m->validDevicePath(array('Device' => $device)); } check(valid(false, array('Type' => 'Local'), array(), 'garbage') === false, 'create of a Local monitor refuses a non-/dev/ Device'); check(valid(false, array('Type' => 'Local'), array(), '/dev/video0') === true, 'create of a Local monitor accepts /dev/video0'); check(valid(3, array('Type' => 'Remote'), array('Type' => 'Local'), 'http://cam/x') === true, 'edit that sets Type Remote accepts a URL'); check(valid(3, array(), array('Type' => 'Local'), 'video0; reboot') === false, 'edit of a stored Local monitor with only a Device refuses a non-/dev/ path'); check(valid(3, array(), array('Type' => 'Local'), '/dev/video1') === true, 'edit of a stored Local monitor accepts /dev/video1'); check(valid(3, array(), array('Type' => 'Remote'), 'http://cam/x') === true, 'edit of a stored Remote monitor keeps a URL Device'); check(valid(3, array(), array('Type' => 'Local'), '') === true, 'an empty Device is still allowed'); echo "\n$passes passed, $failures failed\n"; exit($failures ? 1 : 0);