Exemple #1
0
 /**
  * testChmod method
  *
  * @return void
  */
 public function testChmod()
 {
     $this->skipIf(DS === '\\', 'Folder permissions tests not supported on Windows.');
     $path = TMP . 'tests/';
     $Folder = new Folder($path);
     $subdir = 'test_folder_new';
     $new = $path . $subdir;
     $this->assertTrue($Folder->create($new));
     $this->assertTrue($Folder->create($new . DS . 'test1'));
     $this->assertTrue($Folder->create($new . DS . 'test2'));
     $filePath = $new . DS . 'test1.php';
     $File = new File($filePath);
     $this->assertTrue($File->create());
     $filePath = $new . DS . 'skip_me.php';
     $File = new File($filePath);
     $this->assertTrue($File->create());
     $this->assertTrue($Folder->chmod($new, 0755, true));
     $perms = substr(sprintf('%o', fileperms($new . DS . 'test2')), -4);
     $this->assertEquals('0755', $perms);
     $this->assertTrue($Folder->chmod($new, 0744, true, ['skip_me.php', 'test2']));
     $perms = substr(sprintf('%o', fileperms($new . DS . 'test2')), -4);
     $this->assertEquals('0755', $perms);
     $perms = substr(sprintf('%o', fileperms($new . DS . 'test1')), -4);
     $this->assertEquals('0744', $perms);
 }