public function testGetDBRef()
 {
     $c = $this->object->selectCollection('foo');
     $c->drop();
     for ($i = 0; $i < 50; $i++) {
         $c->insert((object) array('x' => rand()), array("safe" => true));
     }
     $obj = $c->findOne();
     $ref = $this->object->createDBRef('foo', $obj);
     $obj2 = $this->object->getDBRef($ref);
     $this->assertNotNull($obj2);
     $this->assertEquals($obj['x'], $obj2['x']);
 }
 public function testCreateDBRef()
 {
     $arr = (object) array('_id' => new MongoId());
     $ref = $this->object->createDBRef($arr);
     $this->assertNotNull($ref);
     $this->assertTrue(is_array($ref));
     $arr = (object) array('_id' => 1);
     $ref = $this->object->createDBRef($arr);
     $this->assertNotNull($ref);
     $this->assertTrue(is_array($ref));
     $ref = $this->object->createDBRef(new MongoId());
     $this->assertNotNull($ref);
     $this->assertTrue(is_array($ref));
 }