View source
<?php
namespace org\bovigo\vfs;
class TestvfsStreamAbstractContent extends vfsStreamAbstractContent {
protected function getDefaultPermissions() {
return 0777;
}
public function size() {
return 0;
}
}
class vfsStreamAbstractContentTestCase extends \PHPUnit_Framework_TestCase {
public function noPermissionsForEveryone() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 00);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function executePermissionsForUser() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 0100);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertTrue($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function executePermissionsForGroup() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 010);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function executePermissionsForOther() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 01);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isExecutable(-1, -1));
}
public function writePermissionsForUser() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 0200);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertTrue($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function writePermissionsForGroup() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 020);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function writePermissionsForOther() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 02);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function executeAndWritePermissionsForUser() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 0300);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertTrue($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertTrue($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function executeAndWritePermissionsForGroup() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 030);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function executeAndWritePermissionsForOther() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 03);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isExecutable(-1, -1));
}
public function readPermissionsForUser() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 0400);
$this
->assertTrue($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function readPermissionsForGroup() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 040);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function readPermissionsForOther() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 04);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function readAndExecutePermissionsForUser() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 0500);
$this
->assertTrue($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertTrue($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function readAndExecutePermissionsForGroup() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 050);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function readAndExecutePermissionsForOther() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 05);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isExecutable(-1, -1));
}
public function readAndWritePermissionsForUser() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 0600);
$this
->assertTrue($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertTrue($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function readAndWritePermissionsForGroup() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 060);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function readAndWritePermissionsForOther() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 06);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function allPermissionsForUser() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 0700);
$this
->assertTrue($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertTrue($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertTrue($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function allPermissionsForGroup() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 070);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, -1));
}
public function allPermissionsForOther() {
$abstractContent = new TestvfsStreamAbstractContent('foo', 07);
$this
->assertFalse($abstractContent
->isReadable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isReadable(-1, vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isReadable(-1, -1));
$this
->assertFalse($abstractContent
->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isWritable(-1, vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isWritable(-1, -1));
$this
->assertFalse($abstractContent
->isExecutable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()));
$this
->assertFalse($abstractContent
->isExecutable(-1, vfsStream::getCurrentGroup()));
$this
->assertTrue($abstractContent
->isExecutable(-1, -1));
}
}