示例#1
0
 public function testGetCollection()
 {
     $m = new MongoClient();
     Connection::setMongoClient($m);
     $collection = Connection::getCollection('test');
     $this->assertInstanceOf("MongoCollection", $collection);
     $this->assertEquals('test', $collection->getName());
 }
示例#2
0
 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();
 }
示例#3
0
 public function setUp()
 {
     $m = new MongoClient();
     Connection::setMongoClient($m);
     Connection::setDefaultDatabaseName('test');
 }