public function __construct() { $debugOutput = false; $mongoDir = "/usr"; if (!file_exists($mongoDir . '/bin/mongod')) { throw new PHPUnit_Framework_SkippedTestError('mongo daemon not found'); } static $m; if (!isset($m)) { $port = Kwf_Util_Tcp::getFreePort(rand(27020, 30000)); $cmd = "php " . KWF_PATH . "/bootstrap.php test forward --controller=kwf_model_mongo_run-temp-mongo --port={$port}"; if ($debugOutput) { echo $cmd . "\n"; $descriptorspec = array(1 => STDOUT, 2 => STDOUT); } else { $cmd .= " 2>&1 >/dev/null"; $descriptorspec = array(1 => array('pipe', 'w'), 2 => STDOUT); } self::$_proc = new Kwf_Util_Proc($cmd, $descriptorspec); sleep(3); $m = new Mongo("mongodb://localhost:{$port}"); register_shutdown_function(array('Kwf_Model_Mongo_TestModel', 'shutDown')); } $db = $m->selectDB("modeltest"); $db->selectCollection($this->_collection)->drop(); $config = array('db' => $db); parent::__construct($config); }
protected function _init() { parent::_init(); $this->_exprs['parent_name'] = new Kwf_Model_Select_Expr_Parent('Parent', 'name'); }
protected function _init() { $this->_dependentModels['Foo'] = new Kwf_Model_Mongo_RowsSubModel(array('parentModel' => $this, 'fieldName' => 'foo', 'referenceMap' => array('Parent' => array('refModelClass' => 'Kwf_Model_Mongo_ChildRowsWithParentExpr_NoProxy_ParentModel', 'column' => 'parent_id'), 'Mongo' => Kwf_Model_RowsSubModel_Interface::SUBMODEL_PARENT), 'exprs' => array('parent_name' => new Kwf_Model_Select_Expr_Parent('Parent', 'name'), 'mongo_name' => new Kwf_Model_Select_Expr_Parent('Mongo', 'name')))); parent::_init(); }
protected function _init() { parent::_init(); $this->_dependentModels['Foo'] = new Kwf_Model_Mongo_RowsSubModel(array('fieldName' => 'foo', 'parentModel' => $this)); }
protected function _init() { parent::_init(); $this->_exprs['child_count'] = new Kwf_Model_Select_Expr_Child_Count('Child'); }