mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Adding tests for Folder
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5003 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
326c2a900d
commit
74d9a205ec
1 changed files with 43 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Reference in a new issue