Пример #1
0
 public function testAddFile()
 {
     $this->createDummyFile();
     $sovfs = new sovfs_impl();
     //$sovfs->debug = true;
     $sovfs->setFilename($this->vfsFileName);
     $sovfs->setFileNameWithFullPath($this->vfsFileNameWithFullPath);
     $sovfs->setSubModule($this->vfsSubModule);
     $sovfs->debug = true;
     try {
         $sovfs->addFileToVfs();
         echo "Success!";
     } catch (FileExistsException $e) {
         echo "File already exists\n";
     }
     $this->removeDummyFile();
 }
Пример #2
0
 private function createDummyVfsFile()
 {
     $currentDirectory = dirname(__FILE__);
     $fileNameWithPath = $currentDirectory . DIRECTORY_SEPARATOR . $this->vfsFileName;
     $fileHandle = fopen($fileNameWithPath, 'w') or die("Can't open file");
     $result = fwrite($fileHandle, $this->vfsFileContents);
     fclose($fileHandle);
     $sovfs = new sovfs_impl();
     //$sovfs->debug = true;
     $sovfs->setFilename($this->vfsFileName);
     $sovfs->setFileNameWithFullPath($fileNameWithPath);
     $sovfs->setSubModule($this->vfsSubModule);
     try {
         $sovfs->addFileToVfs();
     } catch (FileExistsException $e) {
         echo "File already exists\n";
     }
     $this->vfsFileId = $sovfs->retrieveVfsFileId();
     unlink($fileNameWithPath);
 }