/** * Returns an ArangoDB-PHP document object representing this pod. * @return \triagens\ArangoDb\Document */ public function toDriverDocument() { $document = new \triagens\ArangoDb\Document(); foreach ($this->_data as $key => $value) { $document->set($key, $value); } if ($this->_id) { $document->setInternalId($this->_id); } if ($this->_key) { $document->setInternalKey($this->_key); } if ($this->_rev) { $document->setRevision($this->_rev); } return $document; }
/** * @covers Paradox\pod\Document::loadFromDriver */ public function testLoadFromDriver() { $driverDocument = new \triagens\ArangoDb\Document(); $driverDocument->setInternalId('mycollection/123456'); $driverDocument->setRevision('myrevision'); $driverDocument->set('mykey', 'myvalue'); $this->document->loadFromDriver($driverDocument); $this->assertEquals('mycollection/123456', $this->document->getId(), "The id does not match"); $this->assertEquals('myrevision', $this->document->getRevision(), "The revision does not match"); $this->assertEquals('myvalue', $this->document->get('mykey'), 'The value for "mykey" does not match'); }