Exemplo n.º 1
0
 public function testWorldPermissionsAreCalculatedCorrectly()
 {
     $file = new File('file');
     $ph = new PermissionHelper();
     $ph->setNode($file);
     $file->chmod(00);
     $this->assertFalse($ph->worldCanRead(), 'world can\'t read with 0000');
     $this->assertFalse($ph->worldCanWrite(), 'world can\'t write with 0000');
     $file->chmod(01);
     $this->assertFalse($ph->worldCanRead(), 'world can\'t read with 0001');
     $this->assertFalse($ph->worldCanWrite(), 'world can\'t write with 0001');
     $file->chmod(02);
     $this->assertFalse($ph->worldCanRead(), 'world can\'t read with 0002');
     $this->assertTrue($ph->worldCanWrite(), 'world can write with 0002');
     $file->chmod(04);
     $this->assertTrue($ph->worldCanRead(), 'world can read with 0004');
     $this->assertFalse($ph->worldCanWrite(), 'world can\'t write with 0004');
     $file->chmod(05);
     $this->assertTrue($ph->worldCanRead(), 'world can read with 0005');
     $this->assertFalse($ph->worldCanWrite(), 'world can\'t write with 0005');
     $file->chmod(06);
     $this->assertTrue($ph->worldCanRead(), 'world can read with 0006');
     $this->assertTrue($ph->worldCanWrite(), 'world can read with 0006');
 }