[Filesystem] added a missing CHANGELOG item and fixed some CS

This commit is contained in:
Fabien Potencier 2012-12-11 13:57:29 +01:00
parent b3c58e7b90
commit 7464833ece
3 changed files with 10 additions and 6 deletions

View File

@ -1,6 +1,11 @@
CHANGELOG CHANGELOG
========= =========
2.2.0
-----
* added a delete option for the mirror() method
2.1.0 2.1.0
----- -----

View File

@ -336,7 +336,7 @@ class Filesystem
* Valid options are: * Valid options are:
* - $options['override'] Whether to override an existing file on copy or not (see copy()) * - $options['override'] Whether to override an existing file on copy or not (see copy())
* - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink()) * - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink())
* - $options['delete'] Default false Whether to delete files that are not in the source directory * - $options['delete'] Whether to delete files that are not in the source directory (defaults to false)
* *
* @throws IOException When file type is unknown * @throws IOException When file type is unknown
*/ */

View File

@ -801,22 +801,21 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
$this->filesystem->remove($file1); $this->filesystem->remove($file1);
$this->filesystem->mirror($sourcePath, $targetPath, null, array("delete" => FALSE)); $this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => false));
$this->assertTrue($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1')); $this->assertTrue($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1'));
$this->filesystem->mirror($sourcePath, $targetPath, null, array("delete" => TRUE)); $this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => true));
$this->assertFalse($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1')); $this->assertFalse($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1'));
file_put_contents($file1, 'FILE1'); file_put_contents($file1, 'FILE1');
$this->filesystem->mirror($sourcePath, $targetPath, null, array("delete" => TRUE)); $this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => true));
$this->assertTrue($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1')); $this->assertTrue($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1'));
$this->filesystem->remove($directory); $this->filesystem->remove($directory);
$this->filesystem->mirror($sourcePath, $targetPath, null, array("delete" => TRUE)); $this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => true));
$this->assertFalse($this->filesystem->exists($targetPath.'directory')); $this->assertFalse($this->filesystem->exists($targetPath.'directory'));
$this->assertFalse($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1')); $this->assertFalse($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1'));
} }
public function testMirrorCopiesLinks() public function testMirrorCopiesLinks()