Fixing Folder class tests

This commit is contained in:
Jose Lorenzo Rodriguez 2011-03-12 00:52:23 -04:30
parent d890896777
commit 2bbac9e9b0

View file

@ -322,7 +322,6 @@ class FolderTest extends CakeTestCase {
), ),
array( array(
LIBS . 'config' . DS . 'config.php', LIBS . 'config' . DS . 'config.php',
LIBS . 'config' . DS . 'paths.php',
LIBS . 'config' . DS . 'unicode' . DS . 'casefolding' . DS . '0080_00ff.php', LIBS . 'config' . DS . 'unicode' . DS . 'casefolding' . DS . '0080_00ff.php',
LIBS . 'config' . DS . 'unicode' . DS . 'casefolding' . DS . '0100_017f.php', LIBS . 'config' . DS . 'unicode' . DS . 'casefolding' . DS . '0100_017f.php',
LIBS . 'config' . DS . 'unicode' . DS . 'casefolding' . DS . '0180_024F.php', LIBS . 'config' . DS . 'unicode' . DS . 'casefolding' . DS . '0180_024F.php',
@ -473,9 +472,8 @@ class FolderTest extends CakeTestCase {
$result = $Folder->inCakePath($path); $result = $Folder->inCakePath($path);
$this->assertFalse($result); $this->assertFalse($result);
// WHY DOES THIS FAIL ?? $path = DS . 'lib' . DS . 'Cake' . DS . 'config';
$path = DS . 'cake' . DS . 'config'; $Folder->cd(ROOT . DS . 'lib' . DS . 'Cake' . DS . 'config');
$Folder->cd(ROOT . DS . 'cake' . DS . 'config');
$result = $Folder->inCakePath($path); $result = $Folder->inCakePath($path);
$this->assertTrue($result); $this->assertTrue($result);
} }
@ -490,29 +488,29 @@ class FolderTest extends CakeTestCase {
$Folder = new Folder(); $Folder = new Folder();
$Folder->cd(LIBS . 'config'); $Folder->cd(LIBS . 'config');
$result = $Folder->find(); $result = $Folder->find();
$expected = array('config.php', 'paths.php'); $expected = array('config.php');
$this->assertIdentical(array_diff($expected, $result), array()); $this->assertIdentical(array_diff($expected, $result), array());
$this->assertIdentical(array_diff($result, $expected), array()); $this->assertIdentical(array_diff($result, $expected), array());
$result = $Folder->find('.*', true); $result = $Folder->find('.*', true);
$expected = array('config.php', 'paths.php'); $expected = array('config.php');
$this->assertIdentical($result, $expected); $this->assertIdentical($result, $expected);
$result = $Folder->find('.*\.php'); $result = $Folder->find('.*\.php');
$expected = array('config.php', 'paths.php'); $expected = array('config.php');
$this->assertIdentical(array_diff($expected, $result), array()); $this->assertIdentical(array_diff($expected, $result), array());
$this->assertIdentical(array_diff($result, $expected), array()); $this->assertIdentical(array_diff($result, $expected), array());
$result = $Folder->find('.*\.php', true); $result = $Folder->find('.*\.php', true);
$expected = array('config.php', 'paths.php'); $expected = array('config.php');
$this->assertIdentical($result, $expected); $this->assertIdentical($result, $expected);
$result = $Folder->find('.*ig\.php'); $result = $Folder->find('.*ig\.php');
$expected = array('config.php'); $expected = array('config.php');
$this->assertIdentical($result, $expected); $this->assertIdentical($result, $expected);
$result = $Folder->find('paths\.php'); $result = $Folder->find('config\.php');
$expected = array('paths.php'); $expected = array('config.php');
$this->assertIdentical($result, $expected); $this->assertIdentical($result, $expected);
$Folder->cd(TMP); $Folder->cd(TMP);
@ -544,16 +542,14 @@ class FolderTest extends CakeTestCase {
$Folder->cd(LIBS); $Folder->cd(LIBS);
$result = $Folder->findRecursive('(config|paths)\.php'); $result = $Folder->findRecursive('(config|paths)\.php');
$expected = array( $expected = array(
LIBS . 'config' . DS . 'config.php', LIBS . 'config' . DS . 'config.php'
LIBS . 'config' . DS . 'paths.php'
); );
$this->assertIdentical(array_diff($expected, $result), array()); $this->assertIdentical(array_diff($expected, $result), array());
$this->assertIdentical(array_diff($result, $expected), array()); $this->assertIdentical(array_diff($result, $expected), array());
$result = $Folder->findRecursive('(config|paths)\.php', true); $result = $Folder->findRecursive('(config|paths)\.php', true);
$expected = array( $expected = array(
LIBS . 'config' . DS . 'config.php', LIBS . 'config' . DS . 'config.php'
LIBS . 'config' . DS . 'paths.php'
); );
$this->assertIdentical($result, $expected); $this->assertIdentical($result, $expected);