Permalink
Browse files

Expanding test and fixing issue where the return of Folder::create() …

…would be incorrect even though the directory was properly created. Fixes #996
  • Loading branch information...
1 parent d6e3c31 commit ccfb1d179aec5c7333c726ddfdafdb21ef6d00c7 @markstory markstory committed Aug 10, 2010
Showing with 3 additions and 1 deletion.
  1. +1 −0 cake/libs/folder.php
  2. +2 −1 cake/tests/cases/libs/folder.test.php
@@ -489,6 +489,7 @@ function create($pathname, $mode = false) {
$this->__errors[] = sprintf(__('%s is a file', true), $pathname);
return false;
}
+ $pathname = rtrim($pathname, DS);
$nextPathname = substr($pathname, 0, strrpos($pathname, DS));
if ($this->create($nextPathname, $mode)) {
@@ -108,7 +108,8 @@ function testCreation() {
function testCreateWithTrailingDs() {
$folder =& new Folder(TMP);
$path = TMP . 'tests' . DS . 'trailing' . DS . 'dir' . DS;
- $folder->create($path);
+ $result = $folder->create($path);
+ $this->assertTrue($result);
$this->assertTrue(is_dir($path), 'Folder was not made');

0 comments on commit ccfb1d1

Please sign in to comment.