Пример #1
0
 /**
  * Recursively adds all the files in a directory to the test suite.
  *
  * @param string $directory The directory subtree to add tests from.
  * @return void
  */
 public function addTestDirectoryRecursive($directory = '.')
 {
     $Folder = new Folder($directory);
     $files = $Folder->tree(null, true, 'files');
     foreach ($files as $file) {
         if (substr($file, -4) === '.php') {
             $this->addTestFile($file);
         }
     }
 }
Пример #2
0
 /**
  * testFolderTreeWithHiddenFiles method
  *
  * @return void
  */
 public function testFolderTreeWithHiddenFiles()
 {
     $this->skipIf(!is_writable(TMP), 'Can\'t test Folder::tree with hidden files unless the tmp folder is writable.');
     $path = TMP . 'tests/';
     $Folder = new Folder($path . 'folder_tree_hidden', true, 0777);
     mkdir($Folder->path . DS . '.svn', 0777, true);
     touch($Folder->path . DS . '.svn/InHiddenFolder.php');
     mkdir($Folder->path . DS . '.svn/inhiddenfolder');
     touch($Folder->path . DS . '.svn/inhiddenfolder/NestedInHiddenFolder.php');
     touch($Folder->path . DS . 'not_hidden.txt');
     touch($Folder->path . DS . '.hidden.txt');
     mkdir($Folder->path . DS . 'visible_folder/.git', 0777, true);
     $expected = array(array($Folder->path, $Folder->path . DS . 'visible_folder'), array($Folder->path . DS . 'not_hidden.txt'));
     $result = $Folder->tree(null, true);
     $this->assertEquals($expected, $result);
     $result = $Folder->tree(null, array('.'));
     $this->assertEquals($expected, $result);
     $expected = array(array($Folder->path, $Folder->path . DS . 'visible_folder', $Folder->path . DS . 'visible_folder' . DS . '.git', $Folder->path . DS . '.svn', $Folder->path . DS . '.svn' . DS . 'inhiddenfolder'), array($Folder->path . DS . 'not_hidden.txt', $Folder->path . DS . '.hidden.txt', $Folder->path . DS . '.svn' . DS . 'inhiddenfolder' . DS . 'NestedInHiddenFolder.php', $Folder->path . DS . '.svn' . DS . 'InHiddenFolder.php'));
     $result = $Folder->tree(null, false);
     sort($result[0]);
     sort($expected[0]);
     sort($result[1]);
     sort($expected[1]);
     $this->assertEquals($expected, $result);
     $Folder->delete();
 }