public function testGetDatabase() { $m = new MongoClient(); Connection::setMongoClient($m); $database = Connection::getDatabase('test'); $this->assertInstanceOf("MongoDB", $database); $this->assertEquals("test", "{$database}"); Connection::setDefaultDatabaseName('test1'); $database = Connection::getDatabase(); $this->assertInstanceOf("MongoDB", $database); $this->assertEquals("test1", "{$database}"); }
public function setup() { $m = new MongoClient(); $m->dropDB('test'); Connection::setMongoClient($m); Connection::setDefaultDatabaseName('test'); for ($c = 0; $c < 5; $c++) { $data = ["test{$c}" => "{$c}", "_id" => new MongoId(), "_class" => 'Hydrant\\Document']; $this->records[] = $data; $m->test->default->insert($data); } $this->cursor = $m->test->default->find(); }
public function setUp() { $m = new MongoClient(); Connection::setMongoClient($m); Connection::setDefaultDatabaseName('test'); }