/** * @param array $options (optional) * @return boolean */ protected function initConfig(array $options = array()) { Config::destroyInstance(); if (!empty($options)) { return Config::init(new \MongoClient('mongodb://127.0.0.1', $options), 'ohdm-tests'); } return Config::init(new \MongoClient('mongodb://127.0.0.1', array('connect' => false)), 'ohdm-tests'); }
public function testMongoConnectsAfterInitialisedAndNotConnectedByDefault() { $config = $this->initConfig(array('connect' => false)); $this->assertFalse(@Config::getInstance()->mongo->connected); $collection = new FooBar(); $this->assertEquals('foo_bar', $collection->getSource()); $collection->save(); $collection->delete(); $this->assertTrue(@Config::getInstance()->mongo->connected); }
public function testConfigStoresNotConnectedMongoClientWhenOptionsArePassed() { $config = $this->initConfig(array('connect' => false)); $this->assertFalse(@Config::getInstance()->mongo->connected); }