public function testDelete()
 {
     list($fsManager, $distributor) = $this->getMocks();
     $mockFile = m::mock('Xpressengine\\Storage\\File');
     $mockFile->disk = 'local';
     $mockFile->shouldReceive('getPathname')->andReturn('attached/filenamestring');
     $mockFilesystem = m::mock('Illuminate\\Contracts\\Filesystem\\Filesystem');
     $mockFilesystem->shouldReceive('delete')->once()->with('attached/filenamestring')->andReturnNull();
     $fsManager->shouldReceive('disk')->once()->with('local')->andReturn($mockFilesystem);
     $instance = new FileHandler($fsManager, $distributor);
     $instance->delete($mockFile);
 }
Пример #2
0
 /**
  * remove file
  *
  * @param File $file file instance
  * @return void
  */
 public function remove(File $file)
 {
     // 파일이 원본일 경우 동적으로 생성된 파일 모두 삭제 처리 함
     if ($file->parentId === null) {
         $children = $this->children($file);
         foreach ($children as $child) {
             $this->remove($child);
         }
     }
     $this->repo->delete($file);
     $this->files->delete($file);
 }