Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Filesystem | WCM] 9339 fix stat on url for filesystem copy#9899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -41,7 +41,7 @@ public function copy($originFile, $targetFile, $override = false) | ||
| $this->mkdir(dirname($targetFile)); | ||
| if (!$override && is_file($targetFile) && null == parse_url($originFile, PHP_URL_HOST)) { | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Should be ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. true, sending the PR, thank you chief@stloyd ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. | ||
| $doCopy = filemtime($originFile) > filemtime($targetFile); | ||
| } else { | ||
| $doCopy = true; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -167,6 +167,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)); | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Hmmm... ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. is not for files on the web with Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. TBH. I'm not sure it's good to try to download files from remote servers anyway... ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. is not good, but there is not another way when testing this functionality, these and others are the slowest tests ever that make symfony test suite very slow Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. IMO better approach would be like with i.e. Behat, start server on Travis-CI (Apache, nginx, whatever...) and give fixtures to be downloaded, it would be for sure more safe, and maybe even faster. ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. great call, creating the ticket to be worked on ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. | ||
| } | ||
| public function testMkdirCreatesDirectoriesRecursively() | ||
| { | ||
| $directory = $this->workspace | ||
| @@ -336,7 +349,7 @@ public function testRemoveCleansInvalidLinks() | ||
| mkdir($basePath); | ||
| mkdir($basePath.'dir'); | ||
| // create symlink tononexistent file | ||
| @symlink($basePath.'file', $basePath.'link'); | ||
| $this->filesystem->remove($basePath); | ||