function testFindAndReferences() { $c = new Model1(); $c->a = 5; $c->save(); $d = new Model1(); $d->a = 9; $d->ref = $c; $d->save(); $e = new Model1(); $e->ref = $c; foreach ($e->find() as $r) { $this->assertTrue(MongoDBREf::isRef($r->ref)); $r->doDeferencing(); $this->assertEquals($r->ref->a, $c->a); $this->assertEquals($d->a, $r->a); } }
function testFindWithSingleID() { $d = new Model1(); $d->a = 5; $d->save(); $c = new Model1(); $c->find($d->getID()); $this->assertEquals(1, $c->count()); $this->assertEquals($c->a, $d->a); }