From 74d9a205ec3ac9138a5a0009448d49e98150b71e Mon Sep 17 00:00:00 2001 From: "mariano.iglesias" Date: Fri, 4 May 2007 00:29:33 +0000 Subject: [PATCH] Adding tests for Folder git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5003 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/tests/cases/libs/folder.test.php | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/cake/tests/cases/libs/folder.test.php b/cake/tests/cases/libs/folder.test.php index 1f9d68491..302eb2eb4 100644 --- a/cake/tests/cases/libs/folder.test.php +++ b/cake/tests/cases/libs/folder.test.php @@ -35,6 +35,49 @@ * @since CakePHP Test Suite v 1.0.0.0 */ class FolderTest extends UnitTestCase { + function testBasic() { + $path = dirname(__FILE__); + $this->Folder =& new Folder($path); + + $result = $this->Folder->pwd(); + $this->assertEqual($result, $path); + + $result = $this->Folder->isWindowsPath($path); + $expected = (DS == '\\' ? true : false); + $this->assertEqual($result, $expected); + + $result = $this->Folder->isAbsolute($path); + $this->assertTrue($result); + + $result = $this->Folder->isSlashTerm($path); + $this->assertFalse($result); + + $result = $this->Folder->isSlashTerm($path . DS); + $this->assertTrue($result); + + $result = $this->Folder->addPathElement($path, 'test'); + $expected = $path . DS . 'test'; + $this->assertEqual($result, $expected); + + $result = $this->Folder->cd(ROOT); + $expected = ROOT; + $this->assertEqual($result, $expected); + } + function testInPath() { + $path = dirname(dirname(__FILE__)); + $inside = basename(dirname(__FILE__)) . DS; + + $this->Folder =& new Folder($path); + + $result = $this->Folder->pwd(); + $this->assertEqual($result, $path); + + $result = $this->Folder->isSlashTerm($inside); + $this->assertTrue($result); + + $result = $this->Folder->inPath($inside); + $this->assertTrue($result); + } } ?> \ No newline at end of file