Пример #1
0
 public function setUp()
 {
     Workspace::initWorkspace();
     $this->archivePath = Workspace::getWorkspacePath();
     // create some files
     $dom = new Document();
     $dom->createRoot('hello');
     $dom->save($this->archivePath . '/' . '1.xml');
     $dom->save($this->archivePath . '/' . '2.txt');
     $dom->save($this->archivePath . '/' . '2.xml');
     $this->registry = $this->prophesize(Registry::class);
     $this->xmlEncoder = $this->prophesize(XmlEncoder::class);
     $this->xmlDecoder = $this->prophesize(XmlDecoder::class);
     $this->filesystem = $this->prophesize(Filesystem::class);
     $this->archiver = new XmlArchiver($this->registry->reveal(), $this->xmlEncoder->reveal(), $this->xmlDecoder->reveal(), $this->archivePath, $this->filesystem->reveal());
     $this->historyEntry = $this->prophesize(HistoryEntry::class);
     $this->output = new BufferedOutput();
     $this->storage = $this->prophesize(DriverInterface::class);
     $this->document = $this->prophesize(Document::class);
     $this->collection = $this->prophesize(SuiteCollection::class);
     $this->collection2 = $this->prophesize(SuiteCollection::class);
     $this->registry->getService()->willReturn($this->storage->reveal());
 }
Пример #2
0
 private function createEntry($uuid, \DateTime $date)
 {
     $dom = new Document();
     $test = $dom->createRoot('test');
     $test->setAttribute('uuid', $uuid);
     $path = Workspace::getWorkspacePath() . $date->format('/Y/m/d/') . '/' . $uuid . '.xml';
     if (!$this->filesystem->exists(dirname($path))) {
         $this->filesystem->mkdir(dirname($path));
     }
     $dom->save($path);
     return $this->createCollection($uuid, $date);
 }