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

[PhpUnitBridge] Make ClockMock match namespaces that begin with Tests\\#18726

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
teohhanhui wants to merge1 commit intosymfony:2.8fromteohhanhui:mock-tests-ns

Conversation

@teohhanhui
Copy link
Contributor

@teohhanhuiteohhanhui commentedMay 9, 2016
edited
Loading

QA
Branch?2.8
Bug fix?yes?
New feature?no
BC breaks?no?
Deprecations?no
Tests pass?yes
Fixed ticketsN/A
LicenseMIT
Doc PRsymfony/symfony-docs#6546

See symfony/symfony-standard#969

@teohhanhui
Copy link
ContributorAuthor

/cc@nicolas-grekas

$count =0;
$ns =preg_replace('/(^|\\\\)Tests\\\\/','$1',$mockedNs[0],1,$count);
if (1 ===$count) {
$mockedNs[] =$ns;
Copy link
Member

Choose a reason for hiding this comment

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

imho we should simply additionally check if the namespace starts withTests\:

if (false !==strpos($class,'\\Tests\\')) {// ...}elseif (0 ===strpos('Tests\\')) {$mockedNs[] =substr($class,6);}

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Using regex seems more extensible to me, even though it might not be as readable...

Choose a reason for hiding this comment

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

I'd favor readability here, thus@xabbuh proposal

@teohhanhui
Copy link
ContributorAuthor

@nicolas-grekas: Addressed@xabbuh's comment.

$testNs =substr($class,0,strrpos($class,'\\'));
$mockedNs =array($testNs);
if (false !== ($pos =strpos($testNs,'\\Tests\\'))) {
$mockedNs[] =substr_replace($testNs,'\\',$pos,7);

Choose a reason for hiding this comment

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

this changes the semantic a bit (only the first\Tests\ is replaced now). Let's be safe and keep the code asis for this first part...

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Wouldn't that actually have been a bug? Or was that the intended behaviour?

Choose a reason for hiding this comment

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

not a bug (nor really planned but we shouldn't change now)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Done

@teohhanhuiteohhanhuiforce-pushed themock-tests-ns branch 3 times, most recently from4b00e01 to310eaa5CompareMay 27, 2016 14:56
@teohhanhui
Copy link
ContributorAuthor

I believe Travis failure is unrelated.

$ns =str_replace('\\Tests\\','\\',$class);
$mockedNs[] =substr($ns,0,strrpos($ns,'\\'));
}elseif (0 ===strpos($class,'Tests\\')) {
$mockedNs[] =substr($class,6,strrpos($class,'\\'));
Copy link
Member

Choose a reason for hiding this comment

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

Must be:

$mockedNs[] =substr($class,6,strrpos($class,'\\') -6);

teohhanhui reacted with thumbs up emoji
@teohhanhui
Copy link
ContributorAuthor

Status: Needs Review

@xabbuh
Copy link
Member

👍

Status: Reviewed

@nicolas-grekas
Copy link
Member

feature on 3.2 isn't it?

@teohhanhui
Copy link
ContributorAuthor

feature on 3.2 isn't it?

If so, then we need to address this issue in symfony-standard, because it does not work as expected out of the box.

@nicolas-grekas
Copy link
Member

there is no deps bewteen the bridge and sfstd, so no need to change, just use the newest bridge to run the tests

teohhanhui reacted with thumbs up emoji

@teohhanhui
Copy link
ContributorAuthor

teohhanhui commentedMay 30, 2016
edited
Loading

just use the newest bridge to run the tests

That means bumping the version of the PhpUnit Bridge in symfony-standard 2.8+?

@nicolas-grekas
Copy link
Member

Thank you@teohhanhui.

nicolas-grekas added a commit that referenced this pull requestMay 30, 2016
…egin with Tests\\ (teohhanhui)This PR was submitted for the 2.8 branch but it was merged into the 3.2-dev branch instead (closes#18726).Discussion----------[PhpUnitBridge] Make ClockMock match namespaces that begin with Tests\\| Q             | A| ------------- | ---| Branch?       | 2.8| Bug fix?      | yes?| New feature?  | no| BC breaks?    | no?| Deprecations? | no| Tests pass?   | yes| Fixed tickets | N/A| License       | MIT| Doc PR        |symfony/symfony-docs#6546See symfony/symfony-standard#969Commits-------2630c13 [PhpUnitBridge] Make ClockMock match namespaces that begin with Tests\\
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@teohhanhui@xabbuh@nicolas-grekas@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp