public function testGetSetProfilingLevel() { $created = $this->object->createCollection("system.profile", true, 5000); $prev = $this->object->setProfilingLevel(MongoDB::PROFILING_ON); $level = $this->object->getProfilingLevel(); $this->assertEquals($level, MongoDB::PROFILING_ON); $prev = $this->object->setProfilingLevel(MongoDB::PROFILING_SLOW); $level = $this->object->getProfilingLevel(); $this->assertEquals($level, MongoDB::PROFILING_SLOW); $this->assertEquals($prev, MongoDB::PROFILING_ON); $prev = $this->object->setProfilingLevel(MongoDB::PROFILING_OFF); $level = $this->object->getProfilingLevel(); $this->assertEquals($level, MongoDB::PROFILING_OFF); $this->assertEquals($prev, MongoDB::PROFILING_SLOW); $prev = $this->object->setProfilingLevel(MongoDB::PROFILING_OFF); $this->assertEquals($prev, MongoDB::PROFILING_OFF); }
/** * Constructor of DooMongoModel * @param string $dbName Name of the database * @param string $collectionName Name of the collection * @param DooMongo $mongo Mongo connection instance */ public function __construct($dbName, $collectionName, $mongo = null) { $this->dbName = $dbName; $this->collectionName = $collectionName; if ($mongo === null) { $this->connection = DooMongo::getInstance(); //Doo::conf()->mongodb; } else { $this->connection = $mongo; } $this->collection = $this->connection->selectCollection($dbName, $collectionName); $this->db = $this->connection->selectDB($dbName); //set debugging details; if ($this->connection->isDebugEnabled() === true) { if ($this->db->getProfilingLevel() < 1) { $this->db->setProfilingLevel($this->connection->getProfilingLevel()); } } }
/** * Wrapper method for MongoDB::getProfilingLevel(). * * @see http://php.net/manual/en/mongodb.getprofilinglevel.php * @return integer */ public function getProfilingLevel() { return $this->mongoDB->getProfilingLevel(); }