Xpressengine\Storage\FilesystemHandler::delete PHP Method

delete() public method

remove file from storage
public delete ( File $file ) : boolean
$file File file instance
return boolean
    public function delete(File $file)
    {
        if (!$this->exists($file)) {
            return false;
        }
        return $this->getDisk($file->disk)->delete($file->getPathname());
    }

Usage Example

 public function testDelete()
 {
     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('delete')->once()->with('attached/filenamestring')->andReturnNull();
     $filesystem->shouldReceive('disk')->once()->with('local')->andReturn($mockFilesystem);
     $instance->delete($mockFile);
 }
All Usage Examples Of Xpressengine\Storage\FilesystemHandler::delete