コード例 #1
0
ファイル: FileTest.php プロジェクト: nextinteractive/utils
 /**
  * @expectedException \BackBee\Utils\Exception\InvalidArgumentException
  */
 public function testUnreadableCopy()
 {
     File::copy($this->privatePath, 'bar.txt');
 }
コード例 #2
0
 /**
  * If folder is not present create it and then copy the file
  *
  * @param string $oldImagePath The source file path
  * @param string $newImagePath The target file path
  *
  * @return void
  *
  * @throws \InvalidArgumentException
  * @throws ApplicationException
  */
 protected function createDirAndCopyFile($oldImagePath, $newImagePath)
 {
     try {
         if (!is_dir(dirname($newImagePath))) {
             File::mkdir(dirname($newImagePath));
         }
         File::copy($oldImagePath, $newImagePath);
     } catch (InvalidArgumentException $e) {
         throw new \InvalidArgumentException($e->getMessage());
     } catch (ApplicationException $e) {
         throw $e;
     }
 }