adjusted behavior to always copy override on url files
This commit is contained in:
parent
c92274aea2
commit
4fba412761
@ -41,7 +41,7 @@ class Filesystem
|
||||
|
||||
$this->mkdir(dirname($targetFile));
|
||||
|
||||
if (!$override && is_file($targetFile)) {
|
||||
if (!$override && is_file($targetFile) && null == parse_url($originFile, PHP_URL_HOST)) {
|
||||
$doCopy = filemtime($originFile) > filemtime($targetFile);
|
||||
} else {
|
||||
$doCopy = true;
|
||||
|
@ -167,6 +167,19 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath));
|
||||
}
|
||||
|
||||
public function testCopyForOriginUrlsAndExistingLocalFileDefaultsToNotCopy()
|
||||
{
|
||||
$sourceFilePath = 'http://symfony.com/images/common/logo/logo_symfony_header.png';
|
||||
$targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
file_put_contents($targetFilePath, 'TARGET FILE');
|
||||
|
||||
$this->filesystem->copy($sourceFilePath, $targetFilePath, false);
|
||||
|
||||
$this->assertFileExists($targetFilePath);
|
||||
$this->assertEquals(file_get_contents($sourceFilePath), file_get_contents($targetFilePath));
|
||||
}
|
||||
|
||||
public function testMkdirCreatesDirectoriesRecursively()
|
||||
{
|
||||
$directory = $this->workspace
|
||||
@ -336,7 +349,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
mkdir($basePath);
|
||||
mkdir($basePath.'dir');
|
||||
// create symlink to unexisting file
|
||||
// create symlink to nonexistent file
|
||||
@symlink($basePath.'file', $basePath.'link');
|
||||
|
||||
$this->filesystem->remove($basePath);
|
||||
|
Reference in New Issue
Block a user