mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding Folder tests, fixes cases where ordered directory entries were expected
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8100 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
ed43e95cf3
commit
70f18af78d
1 changed files with 32 additions and 3 deletions
|
@ -271,13 +271,16 @@ class FolderTest extends CakeTestCase {
|
|||
);
|
||||
|
||||
$result = $Folder->tree(TEST_CAKE_CORE_INCLUDE_PATH . 'config', false);
|
||||
$this->assertEqual($result, $expected);
|
||||
$this->assertIdentical(array_diff($expected[0], $result[0]), array());
|
||||
$this->assertIdentical(array_diff($result[0], $expected[0]), array());
|
||||
|
||||
$result = $Folder->tree(TEST_CAKE_CORE_INCLUDE_PATH . 'config', false, 'dir');
|
||||
$this->assertEqual($result, $expected[0]);
|
||||
$this->assertIdentical(array_diff($expected[0], $result), array());
|
||||
$this->assertIdentical(array_diff($result, $expected[0]), array());
|
||||
|
||||
$result = $Folder->tree(TEST_CAKE_CORE_INCLUDE_PATH . 'config', false, 'files');
|
||||
$this->assertEqual($result, $expected[1]);
|
||||
$this->assertIdentical(array_diff($expected[1], $result), array());
|
||||
$this->assertIdentical(array_diff($result, $expected[1]), array());
|
||||
}
|
||||
/**
|
||||
* testWindowsPath method
|
||||
|
@ -405,10 +408,20 @@ class FolderTest extends CakeTestCase {
|
|||
$Folder->cd(TEST_CAKE_CORE_INCLUDE_PATH . 'config');
|
||||
$result = $Folder->find();
|
||||
$expected = array('config.php', 'paths.php');
|
||||
$this->assertIdentical(array_diff($expected, $result), array());
|
||||
$this->assertIdentical(array_diff($result, $expected), array());
|
||||
|
||||
$result = $Folder->find('.*', true);
|
||||
$expected = array('config.php', 'paths.php');
|
||||
$this->assertIdentical($result, $expected);
|
||||
|
||||
$result = $Folder->find('.*\.php');
|
||||
$expected = array('config.php', 'paths.php');
|
||||
$this->assertIdentical(array_diff($expected, $result), array());
|
||||
$this->assertIdentical(array_diff($result, $expected), array());
|
||||
|
||||
$result = $Folder->find('.*\.php', true);
|
||||
$expected = array('config.php', 'paths.php');
|
||||
$this->assertIdentical($result, $expected);
|
||||
|
||||
$result = $Folder->find('.*ig\.php');
|
||||
|
@ -450,6 +463,14 @@ class FolderTest extends CakeTestCase {
|
|||
TEST_CAKE_CORE_INCLUDE_PATH . 'config' . DS . 'config.php',
|
||||
TEST_CAKE_CORE_INCLUDE_PATH . 'config' . DS . 'paths.php'
|
||||
);
|
||||
$this->assertIdentical(array_diff($expected, $result), array());
|
||||
$this->assertIdentical(array_diff($result, $expected), array());
|
||||
|
||||
$result = $Folder->findRecursive('(config|paths)\.php', true);
|
||||
$expected = array(
|
||||
TEST_CAKE_CORE_INCLUDE_PATH . 'config' . DS . 'config.php',
|
||||
TEST_CAKE_CORE_INCLUDE_PATH . 'config' . DS . 'paths.php'
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
|
||||
$Folder->cd(TMP);
|
||||
|
@ -472,6 +493,14 @@ class FolderTest extends CakeTestCase {
|
|||
TMP . 'testme' . DS . 'my.php',
|
||||
TMP . 'testme' . DS . 'paths.php'
|
||||
);
|
||||
$this->assertIdentical(array_diff($expected, $result), array());
|
||||
$this->assertIdentical(array_diff($result, $expected), array());
|
||||
|
||||
$result = $Folder->findRecursive('(paths|my)\.php', true);
|
||||
$expected = array(
|
||||
TMP . 'testme' . DS . 'my.php',
|
||||
TMP . 'testme' . DS . 'paths.php'
|
||||
);
|
||||
$this->assertIdentical($result, $expected);
|
||||
|
||||
$Folder->cd(TEST_CAKE_CORE_INCLUDE_PATH . 'config');
|
||||
|
|
Loading…
Reference in a new issue