Example #1
0
 public function testGroupPermissionsAreCalculatedCorrectly()
 {
     $file = new File('file');
     $file->chgrp($this->gid);
     $ph = new PermissionHelper();
     $ph->setNode($file);
     $file->chmod(00);
     $this->assertFalse($ph->groupCanRead(), 'group can\'t read with 0000');
     $this->assertFalse($ph->groupCanWrite(), 'group can\'t write with 0000');
     $file->chmod(010);
     $this->assertFalse($ph->groupCanRead(), 'group can\'t read with 0010');
     $this->assertFalse($ph->groupCanWrite(), 'group can\'t write with 0010');
     $file->chmod(020);
     $this->assertFalse($ph->groupCanRead(), 'group can\'t read with 0020');
     $this->assertTrue($ph->groupCanWrite(), 'group can write with 0020');
     $file->chmod(040);
     $this->assertTrue($ph->groupCanRead(), 'group can read with 0040');
     $this->assertFalse($ph->groupCanWrite(), 'group can\'t write with 0040');
     $file->chmod(050);
     $this->assertTrue($ph->groupCanRead(), 'group can read with 0050');
     $this->assertFalse($ph->groupCanWrite(), 'group can\'t write with 0050');
     $file->chmod(060);
     $this->assertTrue($ph->groupCanRead(), 'group can read with 0060');
     $this->assertTrue($ph->groupCanWrite(), 'group can read with 0060');
     $file->chgrp(0);
     $file->chmod(0666);
     $this->assertFalse($ph->groupCanRead(), 'group can\'t read without ownership');
     $this->assertFalse($ph->groupCanWrite(), 'group can\'t without ownership');
 }