Пример #1
0
 public function testOpenDirectory_SomeDirectory()
 {
     $this->storage->createDirectory('some_directory/');
     $fileinfo = new FileInfo($this->storage->getPath('some_directory/'));
     $expected = new DirectoryObject($fileinfo->getRealPath());
     $this->assertEquals($expected, $fileinfo->openDirectory());
 }
Пример #2
0
 public function copyTo($pathDestinationFile, $copyMode = CopyMode::SKIP_EXISTING, $mode = 0644)
 {
     $destinationFile = new FileInfo($pathDestinationFile);
     if (!$destinationFile->isExists()) {
         if (!@copy($this->getRealPath(), $destinationFile->getPathname())) {
             throw new Exception\PermissionDeniedException();
         }
         if (!@chmod($destinationFile->getRealPath(), $mode)) {
             throw new Exception\PermissionDeniedException();
         }
     } elseif ($copyMode == CopyMode::ABORT_IF_EXISTS) {
         throw new Exception\AbortException();
     }
 }