Permalink
Browse files

Merge branch '2.4'

* 2.4:
  [Security] fixed pre/post authentication checks
  fixed missing use statements
  Updated lithuanian validator translation: changed vartotojas to naudotojas as it is more proper term.
  Fixed CSS
  [Intl] Added round support for ROUND_CEILING, ROUND_FLOOR, ROUND_DOWN, ROUND_UP
  [HttpFoundation] Throw proper exception when invalid data is passed to JsonResponse class
  addressed == -> === suggestion
  Fixed #9020 - Added support for collections in service#parameters
  fixes PSR-0 issues in tests
  adjusted behavior to always copy override on url files
  Skips test that need full lib-intl.
  • Loading branch information...
2 parents f316a10 + b3c3b5a commit 548000429823d067206bdfe73d4eb850c585e810 @fabpot fabpot committed Dec 31, 2013
Showing with 15 additions and 2 deletions.
  1. +1 −1 Filesystem.php
  2. +14 −1 Tests/FilesystemTest.php
View
@@ -43,7 +43,7 @@ public function copy($originFile, $targetFile, $override = false)
$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;
View
@@ -121,6 +121,19 @@ public function testCopyCreatesTargetDirectoryIfItDoesNotExist()
$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
@@ -290,7 +303,7 @@ public function testRemoveCleansInvalidLinks()
mkdir($basePath);
mkdir($basePath.'dir');
- // create symlink to unexisting file
+ // create symlink to nonexistent file
@symlink($basePath.'file', $basePath.'link');
$this->filesystem->remove($basePath);

0 comments on commit 5480004

Please sign in to comment.