Esempio n. 1
0
 public function testMaskSetting()
 {
     if (DS === '\\') {
         $this->markTestSkipped('File permission testing does not work on Windows.');
     }
     $path = TMP . 'tests' . DS;
     $this->_deleteLogs($path);
     $log = new FileLog(array('path' => $path, 'mask' => 0666));
     $log->write('warning', 'Test warning one');
     $result = substr(sprintf('%o', fileperms($path . 'error.log')), -4);
     $expected = '0666';
     $this->assertEquals($expected, $result);
     unlink($path . 'error.log');
     $log = new FileLog(array('path' => $path, 'mask' => 0644));
     $log->write('warning', 'Test warning two');
     $result = substr(sprintf('%o', fileperms($path . 'error.log')), -4);
     $expected = '0644';
     $this->assertEquals($expected, $result);
     unlink($path . 'error.log');
     $log = new FileLog(array('path' => $path, 'mask' => 0640));
     $log->write('warning', 'Test warning three');
     $result = substr(sprintf('%o', fileperms($path . 'error.log')), -4);
     $expected = '0640';
     $this->assertEquals($expected, $result);
     unlink($path . 'error.log');
 }