Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Filesystem] mirror - fix copying content with same name as source/target.#23473

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

Closed
gitlost wants to merge4 commits intosymfony:2.7fromgitlost:ticket_23472

Conversation

@gitlost
Copy link
Contributor

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#23472
LicenseMIT
Doc PR

Usessubstr() and lengths inFilesystem::mirror() rather thanstr_replace() to avoid multiple replacements.

@xabbuh
Copy link
Member

I would split the test case into two (one with thedelete option, the other one without it) to make them independent from each other.

@nicolas-grekas
Copy link
Member

@gitlost could you please split the test case in two as suggested by@xabbuh ?

$this->assertFileExists($targetPath.'source');
$this->assertFileExists($targetPath.'target');

chdir($oldPath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this can be removed now

$this->assertFileExists($targetPath.'source');
$this->assertFileNotExists($targetPath.'target');

chdir($oldPath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

same here

{
$sourcePath =$this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;

$oldPath =getcwd();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

not needed

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Could you be less cryptic please? What isn't needed and why? Ditto for other comments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We do not need thechdir() call after the assertions at the end of both methods. Therefore, we can also removed the$oldPath variable.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Could you give a reason please? The save/restorechdir()s are following the same pattern as the existing teststestFilesExistsFails() andtestMirrorCopiesRelativeLinkedContents() and it seems good practice to leave things as you find them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Doing clean up work after performing assertions is not reliable. As soon as one of the assertions fails clean up work will not happen anymore. So what we could is remember the current directory inside the base class'setUp() method and restore it intearDown().

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Doing clean up work after performing assertions is not reliable.

True, I've moved them to directly before and after the call tomirror().

So what we could is...

Another PR perhaps?

{
$sourcePath =$this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;

$oldPath =getcwd();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

not needed

@xabbuh
Copy link
Member

ping @symfony/deciders

Copy link
Member

@javiereguiluzjaviereguiluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@gitlost thanks for fixing this bug ... and congrats on your first Symfony contribution!

@fabpot
Copy link
Member

Thank you@gitlost.

fabpot added a commit that referenced this pull requestSep 13, 2017
…s source/target. (gitlost)This PR was squashed before being merged into the 2.7 branch (closes#23473).Discussion----------[Filesystem] mirror - fix copying content with same name as source/target.| Q             | A| ------------- | ---| Branch?       |  2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#23472| License       | MIT| Doc PR        |Uses `substr()` and lengths in `Filesystem::mirror()` rather than `str_replace()` to avoid multiple replacements.Commits-------b524c84 [Filesystem] mirror - fix copying content with same name as source/target.
@fabpotfabpot closed thisSep 13, 2017
This was referencedOct 5, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@javiereguiluzjaviereguiluzjaviereguiluz approved these changes

@xabbuhxabbuhxabbuh approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

2.7

Development

Successfully merging this pull request may close these issues.

6 participants

@gitlost@xabbuh@nicolas-grekas@fabpot@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp