mirror of
https://github.com/adlawson/php-vfs.git
synced 2024-11-23 21:27:39 +00:00
Merge pull request #16 from adlawson/basic-permissions
Set basic permission bits
This commit is contained in:
commit
75e2fde9b7
@ -30,7 +30,7 @@ class Directory implements NodeContainerInterface
|
||||
*/
|
||||
public function __construct(array $nodes = [])
|
||||
{
|
||||
$this->mode = self::TYPE_DIR;
|
||||
$this->mode = self::TYPE_DIR | self::OTHER_FULL;
|
||||
|
||||
$this->dateAccessed = new DateTime();
|
||||
$this->dateCreated = $this->dateAccessed;
|
||||
|
@ -25,7 +25,7 @@ class DirectoryLink implements NodeContainerInterface, LinkInterface
|
||||
public function __construct(NodeContainerInterface $directory)
|
||||
{
|
||||
$this->directory = $directory;
|
||||
$this->mode = self::TYPE_LINK;
|
||||
$this->mode = self::TYPE_LINK | self::OTHER_FULL;
|
||||
|
||||
$this->dateAccessed = new DateTime();
|
||||
$this->dateCreated = clone $this->dateAccessed;
|
||||
|
@ -25,7 +25,7 @@ class File implements FileInterface
|
||||
public function __construct($content = '')
|
||||
{
|
||||
$this->content = (string) $content;
|
||||
$this->mode = self::TYPE_FILE;
|
||||
$this->mode = self::TYPE_FILE | self::OTHER_FULL;
|
||||
|
||||
$this->dateAccessed = new DateTime();
|
||||
$this->dateCreated = clone $this->dateAccessed;
|
||||
|
@ -25,7 +25,7 @@ class FileLink implements FileInterface, LinkInterface
|
||||
public function __construct(FileInterface $file)
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->mode = self::TYPE_LINK;
|
||||
$this->mode = self::TYPE_LINK | self::OTHER_FULL;
|
||||
|
||||
$this->dateAccessed = new DateTime();
|
||||
$this->dateCreated = clone $this->dateAccessed;
|
||||
|
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace Vfs\Stream\StreamWrapper;
|
||||
|
||||
use Vfs\Test\AcceptanceTestCase;
|
||||
|
||||
class PermissionAcceptanceTest extends AcceptanceTestCase
|
||||
{
|
||||
protected $tree = [
|
||||
'foo' => [
|
||||
'bar' => 'baz'
|
||||
]
|
||||
];
|
||||
|
||||
public function testDirIsReadable()
|
||||
{
|
||||
$this->assertTrue(is_readable("$this->scheme:///foo"));
|
||||
}
|
||||
|
||||
public function testDirIsWritable()
|
||||
{
|
||||
$this->assertTrue(is_writable("$this->scheme:///foo"));
|
||||
}
|
||||
|
||||
public function testDirIsExecutable()
|
||||
{
|
||||
// Directory can't be executable
|
||||
$this->assertFalse(is_executable("$this->scheme:///foo"));
|
||||
}
|
||||
|
||||
public function testFileIsReadable()
|
||||
{
|
||||
$this->assertTrue(is_readable("$this->scheme:///foo/bar"));
|
||||
}
|
||||
|
||||
public function testFileIsWritable()
|
||||
{
|
||||
$this->assertTrue(is_writable("$this->scheme:///foo/bar"));
|
||||
}
|
||||
|
||||
public function testFileIsExecutable()
|
||||
{
|
||||
$this->assertTrue(is_executable("$this->scheme:///foo/bar"));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user