public function testGetDocumentByReference() { // create document $document = $this->collection->createDocument(array('param' => 'value'))->save(); // invalid col and db $foundDocument = $this->collection->getDocumentByReference(array('$ref' => 'some_collection', '$db' => 'some_db', '$id' => $document->getId()), false); $this->assertNull($foundDocument); /// invalid db $foundDocument = $this->collection->getDocumentByReference(array('$ref' => $this->collection->getName(), '$db' => 'some_db', '$id' => $document->getId()), false); $this->assertNull($foundDocument); // all valid $foundDocument = $this->collection->getDocumentByReference(array('$ref' => $this->collection->getName(), '$db' => $this->collection->getDatabase()->getName(), '$id' => $document->getId()), false); $this->assertSame((string) $document->getId(), (string) $foundDocument->getId()); }