row = is_array($row) ? $row : array(); } function canEdit() { return true; } function commandFieldChangesNotAllowed($f) { return array(); } function Type() { return "Ffmpeg"; } function Controllable() { return false; } function Capturing() { return "Always"; } function Deleted() { return false; } function zmcControl($c) { self::$calls[] = "zmc:$c"; } function sendControlCommand($c) { self::$calls[] = "ctl:$c"; } function zmtrackControl($c) { self::$calls[] = "zmtrack:$c"; } }'); class FakeModel { public $id = 7; function exists($id = null) { return true; } function create() {} function find($t = 'first', $o = array()) { return array('Monitor' => array('Id' => 7)); } function save($d = null) { return true; } function validates() { return true; } } class FakeRequest { public $data = array(); public $m; function __construct($m) { $this->m = $m; } function is($t) { return in_array($this->m, (array)$t, true); } } class FakeController { public $Monitor; public $request; public $out; function set($a) { $this->out = $a; } function requestCommandFields() { return array(); } function pinRequestId($m, $id) {} protected function resizeZones($id, $old, $new) {} } eval('class FakeCtl extends FakeController { '.$fix(extractMethod($source, 'edit')).' '.$fix(extractMethod($source, 'add')).' }'); foreach (array('edit', 'add') as $which) { ZM\Monitor::$calls = array(); $c = new FakeCtl(); $c->Monitor = new FakeModel(); $c->request = new FakeRequest('post'); global $user; $user = null; if ($which == 'edit') $c->edit(7); else $c->add(); check("$which starts zmtrack.pl after zmc", in_array('zmtrack:start', ZM\Monitor::$calls, true), true); } exit($failures ? 1 : 0);