예제 #1
0
파일: Dir.php 프로젝트: jasny/Q
 /**
  * Class constructor
  * 
  * @param string $path
  * @param array  $content
  */
 public function __construct($path, $content = null)
 {
     parent::__construct($path);
     if (isset($content)) {
         $this->content = $content;
     }
     if ($path == '/tmp/q-config_dirtest-31e4649e807c8cadf222ee2428fee1c1/dir1') {
         var_dump($this->content);
         exit;
     }
     if (!is_dir($this->_path)) {
         throw new PHPUnit_Framework_SkippedTestError("Can't use Config_Mock_Dir object: '{$this->_path} does not exist");
     }
     foreach ($this->content as $file => $sub) {
         if ($sub == 0) {
             touch("{$this->_path}/{$file}");
         } else {
             mkdir("{$this->_path}/{$file}");
         }
     }
 }
예제 #2
0
파일: DirTest.php 프로젝트: jasny/Q
 /**
  * Tests Fs_Node->create() with existing file
  */
 public function testCreate_Recursive()
 {
     if (function_exists('posix_getuid') && posix_getuid() == 0) {
         $this->markTestSkipped("Won't test this as root for safety reasons.");
     }
     $filename = "{$this->file}.y/" . basename($this->file);
     $new = new Fs_Dir($filename);
     umask(022);
     $new->create(0770, Fs::RECURSIVE);
     $this->assertTrue(is_dir($filename));
     $this->assertEquals('0750', sprintf('%04o', fileperms($filename) & 0777));
     $this->assertEquals('0750', sprintf('%04o', fileperms(dirname($filename)) & 0777));
 }