Xpressengine\Storage\FilesystemHandler::exists PHP Method

exists() public method

check exists a file
public exists ( File $file ) : boolean
$file File file instance
return boolean
    public function exists(File $file)
    {
        return $this->getDisk($file->disk)->exists($file->getPathname());
    }

Usage Example

 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));
 }
All Usage Examples Of Xpressengine\Storage\FilesystemHandler::exists