mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 20:46:24 +00:00
Merge pull request #370 from shama/patch-foldertree-test
Add test case for Folder::tree with hidden files
This commit is contained in:
commit
039e041665
1 changed files with 45 additions and 0 deletions
|
@ -411,6 +411,51 @@ class FolderTest extends CakeTestCase {
|
||||||
$this->assertSame(array_diff($expected[1], $result), array());
|
$this->assertSame(array_diff($expected[1], $result), array());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testFolderTreeWithHiddenFiles method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testFolderTreeWithHiddenFiles() {
|
||||||
|
$this->skipIf(!is_writeable(TMP), 'Cant test Folder::tree with hidden files unless the tmp folder is writable.');
|
||||||
|
|
||||||
|
$Folder = new Folder(TMP . 'folder_tree_hidden', true, 0777);
|
||||||
|
mkdir($Folder->path . DS . '.svn', 0777, true);
|
||||||
|
touch($Folder->path . DS . '.svn' . DS . 'InHiddenFolder.php');
|
||||||
|
touch($Folder->path . DS . 'not_hidden.txt');
|
||||||
|
touch($Folder->path . DS . '.hidden.txt');
|
||||||
|
|
||||||
|
$expected = array(
|
||||||
|
array(
|
||||||
|
$Folder->path,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
$Folder->path . DS . 'not_hidden.txt',
|
||||||
|
$Folder->path . DS . '.svn' . DS . 'InHiddenFolder.php',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
$result = $Folder->tree(null, false);
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
$expected = array(
|
||||||
|
array(
|
||||||
|
$Folder->path,
|
||||||
|
$Folder->path . DS . '.svn',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
$Folder->path . DS . 'not_hidden.txt',
|
||||||
|
$Folder->path . DS . '.hidden.txt',
|
||||||
|
$Folder->path . DS . '.svn' . DS . 'InHiddenFolder.php',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
$result = $Folder->tree(null, true);
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
$Folder->delete();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testWindowsPath method
|
* testWindowsPath method
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue