Skip to content
Permalink
Browse files

Add tests for #4521 and reformat code.

Add a regression test for #4521 as the original author didn't have one.
Reformat a long line since I was nearby already.

Closes #4521
  • Loading branch information...
markstory committed Sep 10, 2014
1 parent 29570e1 commit 86bc7f186194bb1da3b84873987fb4be0071b85f
Showing with 29 additions and 1 deletion.
  1. +22 −0 lib/Cake/Test/Case/Utility/FolderTest.php
  2. +7 −1 lib/Cake/Utility/Folder.php
@@ -973,6 +973,28 @@ public function testCopyWithSkip() {
$Folder->delete();
}
/**
* Test that SKIP mode skips files too.
*
* @return void
*/
public function testCopyWithSkipFileSkipped() {
$path = TMP . 'folder_test';
$folderOne = $path . DS . 'folder1';
$folderTwo = $path . DS . 'folder2';
new Folder($path, true);
new Folder($folderOne, true);
new Folder($folderTwo, true);
file_put_contents($folderOne . DS . 'fileA.txt', 'Folder One File');
file_put_contents($folderTwo . DS . 'fileA.txt', 'Folder Two File');
$Folder = new Folder($folderOne);
$result = $Folder->copy(array('to' => $folderTwo, 'scheme' => Folder::SKIP));
$this->assertTrue($result);
$this->assertEquals('Folder Two File', file_get_contents($folderTwo . DS . 'fileA.txt'));
}
/**
* testCopyWithOverwrite
*
@@ -645,7 +645,13 @@ public function copy($options) {
$to = $options;
$options = array();
}
$options += array('to' => $to, 'from' => $this->path, 'mode' => $this->mode, 'skip' => array(), 'scheme' => Folder::MERGE);
$options += array(
'to' => $to,
'from' => $this->path,
'mode' => $this->mode,
'skip' => array(),
'scheme' => Folder::MERGE
);
$fromDir = $options['from'];
$toDir = $options['to'];

0 comments on commit 86bc7f1

Please sign in to comment.
You can’t perform that action at this time.