/ */ class P4_Spec_PluralMock extends P4_Spec_PluralAbstract { protected static $_specType = 'job'; protected static $_idField = 'Job'; /** * This function provides the tests access to any protected functions. * * @param string $function Name of function to be called on this object * @param array|string $params Paramater(s) to pass, optional * @return mixed Return result of called function, False on error */ public function callProtectedFunc($function, $params = array()) { if (!is_array($params)) { $params = array($params); } return call_user_func_array(array($this, $function), $params); } /** * This function provides the tests access to any protected static functions. * * @param string $function Name of function to be called on this object * @param array|string $params Paramater(s) to pass, optional * @return mixed Return result of called function, False on error */ public static function callProtectedStaticFunc($function, $params = array()) { if (!is_array($params)) { $params = array($params); } return call_user_func_array('static::'.$function, $params); } /** * This function provides the tests set capabilities on protected static variables. * * @param string $name Name of variable to set/update on this object * @param mixed $value New value to use */ public static function setProtectedStaticVar($name, $value) { static::${$name} = $value; } /** * Determine if the given job id exists. * * @param string $id the id to check for. * @param P4_Connection_Interface $connection optional - a specific connection to use. * @return bool true if the given id matches an existing job. */ public static function exists($id, P4_Connection_Interface $connection = null) { // if no connection given, use default. $connection = $connection ?: static::getDefaultConnection(); $result = $connection->run("jobs", array("-e", "Job=$id")); return (bool) count($result->getData()); } }