public function testSetOptions() { $connection = new Connection($this->uri, $this->dbName); $connection->setOptions($options = array('connect' => true)); $this->assertSame($options, $connection->getOptions()); $connection->getClient(); try { $connection->setOptions(array()); $this->fail(); } catch (\Exception $e) { $this->assertInstanceOf('LogicException', $e); } }
public function testMandangoLoggerWithLoggerCallable() { $connection = new Connection($this->server, $this->dbName); $connection->setLoggerCallable($loggerCallable = array($this, 'log')); $connection->setLogDefault($logDefault = array('foo' => 'bar')); $mongo = $connection->getMongo(); $mongoDB = $connection->getMongoDB(); $this->assertInstanceOf('\\Mandango\\Logger\\LoggableMongo', $mongo); $this->assertInstanceOf('\\Mandango\\Logger\\LoggableMongoDB', $mongoDB); $this->assertSame($loggerCallable, $mongo->getLoggerCallable()); $this->assertSame($logDefault, $mongo->getLogDefault()); $this->assertSame($this->dbName, $mongoDB->__toString()); $this->assertSame($mongo, $connection->getMongo()); $this->assertSame($mongoDB, $connection->getMongoDB()); }