public function testCanRead() { $path = __DIR__ . '/../../_upload/'; $st = new Storage(array('path' => $path)); $doc = new Document(); $doc->setId('e2bd813816c305a8a22e03c95d2ee8fd3f7bc710'); $file = $st->read($doc, 'fdff'); $this->assertEquals(file_get_contents(__DIR__ . '/../../_upload/e2/bd/813816c305a8a22e03c95d2ee8fd3f7bc710.inf'), serialize($doc)); }
/** * Get New Document. * * @return \Dms\Document\Document */ public function getNewDocument() { if (null === $this->new_document) { $this->new_document = new Document(); if (null !== $this->document) { $this->new_document->setName($this->document->getName()); } } return $this->new_document; }
public function testCanGetSupportDefault() { $document = new Document(); $sup = $document->getSupport(); $this->assertEquals($sup, 'data'); }
/** * {@inheritdoc} * * @param \Dms\Document\Document $document * @param string $ext * * @see \Dms\Storage\StorageInterface::getPath() */ public function getPath(\Dms\Document\Document $document, $ext = '') { $name = $document->getId() . $ext; $filename = $this->getBasePath() . substr($name, 0, 2) . '/' . substr($name, 2, 2) . '/' . substr($name, 4); if (!file_exists($filename)) { throw new \Exception('no file'); } return $filename; }