Author: XE Team (developers) (developers@xpressengine.com)
Inheritance: implements Xpressengine\Storage\ContentReaderInterface
 public function testExists()
 {
     list($filesystem) = $this->getMocks();
     $instance = new FilesystemHandler($filesystem);
     $mockFile = m::mock('Xpressengine\\Storage\\File');
     $mockFile->shouldReceive('getAttribute')->once()->with('disk')->andReturn('local');
     $mockFile->shouldReceive('getPathname')->andReturn('attached/filenamestring');
     $mockFilesystem = m::mock('Illuminate\\Contracts\\Filesystem\\Filesystem');
     $mockFilesystem->shouldReceive('exists')->once()->with('attached/filenamestring')->andReturn(true);
     $filesystem->shouldReceive('disk')->once()->with('local')->andReturn($mockFilesystem);
     $this->assertTrue($instance->exists($mockFile));
 }
Example #2
0
 /**
  * remove file
  *
  * @param File $file file instance
  * @return bool
  */
 public function remove(File $file)
 {
     // 파일이 원본일 경우 동적으로 생성된 파일 모두 삭제 처리 함
     if ($file->originId === null) {
         foreach ($file->getRawDerives() as $child) {
             $this->remove($child);
         }
     }
     $file->getConnection()->table($file->getFileableTable())->where('fileId', $file->id)->delete();
     $this->files->delete($file);
     return $file->delete();
 }
Example #3
0
 /**
  * remove file
  *
  * @param File $file file instance
  * @return bool
  */
 public function remove(File $file)
 {
     // 파일이 원본일 경우 동적으로 생성된 파일 모두 삭제 처리 함
     if ($file->originId === null) {
         foreach ($file->getRawDerives() as $child) {
             $this->remove($child);
         }
     }
     $this->files->delete($file);
     return $file->delete();
 }