Skip to content

Commit

Permalink
This closes #14832 by adding isReadable
Browse files Browse the repository at this point in the history
  • Loading branch information
themsaid committed Sep 6, 2016
1 parent 2992315 commit 4c0c08c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Illuminate/Filesystem/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,17 @@ public function isWritable($path)
return is_writable($path);
}

/**
* Determine if the given path is readable.
*
* @param string $path
* @return bool
*/
public function isReadable($path)
{
return is_readable($path);
}

/**
* Determine if the given path is a file.
*
Expand Down
11 changes: 11 additions & 0 deletions tests/Filesystem/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,17 @@ public function testIsWritable()
$this->assertTrue($files->isWritable($this->tempDir.'/foo.txt'));
}

public function testIsReadable()
{
file_put_contents($this->tempDir.'/foo.txt', 'foo');
$files = new Filesystem();
@chmod($this->tempDir.'/foo.txt', 0000);
$this->assertFalse($files->isReadable($this->tempDir.'/foo.txt'));
$this->assertFalse($files->isReadable($this->tempDir.'/bar.txt'));
@chmod($this->tempDir.'/foo.txt', 0777);
$this->assertTrue($files->isReadable($this->tempDir.'/foo.txt'));
}

public function testGlobFindsFiles()
{
file_put_contents($this->tempDir.'/foo.txt', 'foo');
Expand Down

0 comments on commit 4c0c08c

Please sign in to comment.