mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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
This commit is contained in:
parent
29570e1d99
commit
86bc7f1861
2 changed files with 29 additions and 1 deletions
|
@ -973,6 +973,28 @@ class FolderTest extends CakeTestCase {
|
|||
$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 @@ class Folder {
|
|||
$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'];
|
||||
|
|
Loading…
Reference in a new issue