1, 'ActiveMonitorCount' => 1, 'Id' => 7); } function dbFetchAll($sql, $col = null, $params = array()) { $GLOBALS['sqls'][] = $sql; return array(); } function ajaxResponse($data = array()) { $GLOBALS['response'] = $data; throw new StopRequest('ok'); } function ajaxError($m) { throw new StopRequest($m); } $scenario = $argv[1]; $_REQUEST = array('entity' => ($scenario == 'system') ? 'system' : 'frames'); if ($scenario == 'sort_array') $_REQUEST += array('id' => '7', 'sort' => array('FrameId')); $thrown = ''; try { include __DIR__.'/../../web/ajax/status.php'; } catch (StopRequest $e) { } catch (Throwable $e) { $thrown = $e->getMessage(); } if ($scenario == 'system') { $sql = $sqls ? $sqls[0] : ''; $ok = preg_match('/count\(if\(`?Deleted`? *= *(0|false),[^)]*\)\) as MonitorCount/i', $sql) && preg_match('/count\(if\(`?Deleted`? *= *(0|false) *and `Capturing` != \'None\',/i', $sql); echo ($ok ? 'ok' : 'FAIL').' - system counts leave out deleted monitors'.($ok ? '' : " ($sql)")."\n"; } else { $ok = ($thrown === ''); echo ($ok ? 'ok' : 'FAIL').' - array sort is ignored'.($ok ? '' : " (threw: $thrown)")."\n"; } exit($ok ? 0 : 1); }