Example #1
0
 /**
  * FolderLibTest::testClear()
  *
  * @return void
  */
 public function testClear()
 {
     $folder = TMP;
     mkdir($folder . 'x' . DS . 'y', 0770, true);
     touch($folder . 'x' . DS . 'y' . DS . 'one.txt');
     touch($folder . 'x' . DS . 'two.txt');
     $Folder = new FolderLib($folder . 'x');
     $result = $Folder->clear();
     $this->assertTrue($result);
     $this->assertTrue(is_dir($folder . 'x'));
     $this->assertFalse(is_dir($folder . 'x' . DS . 'y'));
     $this->assertFalse(is_file($folder . 'x' . DS . 'two.txt'));
     $Folder->delete($folder . 'x');
     $this->assertFalse(is_file($folder . 'x'));
 }
 /**
  * Update CakePHP sniffs.
  *
  * @param string $target Absolute path to extract to.
  * @return boolean Success
  */
 protected function _installRules($target)
 {
     $tmp = TMP . 'cs' . DS;
     $this->_extractZip($tmp . 'cakephp.zip');
     $folder = $tmp . 'cakephp-codesniffer-phpcs-fixer' . DS;
     if (WINDOWS) {
         $windowsNewlines = strpos(file_get_contents(__FILE__), "\r\n") !== false;
         if ($windowsNewlines) {
             $this->_correctNewlines($folder);
         }
     }
     $Folder = new FolderLib($target);
     $Folder->clear();
     $Folder = new FolderLib($folder);
     return $Folder->copy(['to' => $target]);
 }