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

[FrameworkBundle] fix BC-breaking property in WebTestAssertionsTrait#31880

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

Merged

Conversation

@nicolas-grekas
Copy link
Member

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

No properties should be exposed.

alexislefebvre, malarzm, raress96, fzieris, SiM07, and romainnorberg reacted with thumbs up emoji
@nicolas-grekas
Copy link
MemberAuthor

nicolas-grekas commentedJun 5, 2019
edited
Loading

Why is this a trait BTW, and not plain methods on WebTestCase?
Unless I missed it,#30813 doesn't tell about that, does it?

@OskarStark
Copy link
Contributor

I can’t remember why, maybe@Pierstoval can help us

@Pierstoval
Copy link
Contributor

The trait was not discussed, I thought it was convenient to have all assertions in one place, especially when needing them statically. A fix to make the client static in the trait is welcomed, indeed.

@nicolas-grekasnicolas-grekasforce-pushed thefix-webtestassertionstrait branch from835280b to3b50107CompareJune 6, 2019 06:53
@nicolas-grekasnicolas-grekasforce-pushed thefix-webtestassertionstrait branch from3b50107 to6253926CompareJune 6, 2019 06:55
publicstaticfunctionassertResponseIsSuccessful(string$message =''):void
{
self::assertThat(static::getResponse(),newResponseConstraint\ResponseIsSuccessful(),$message);
self::assertThat(self::getResponse(),newResponseConstraint\ResponseIsSuccessful(),$message);
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Traits should be self contained, we shouldn't provide these as extensibility points.

andrew-demb reacted with thumbs up emoji
}

privatestaticfunctiongetClient():KernelBrowser
privatestaticfunctiongetClient(KernelBrowser$newClient =null):?KernelBrowser
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would it returnnull? If the client is null, it should alway throw an exception, shouldn't it? If it's null, all the rest of the trait's codebase would be forced to check for null pointer 😕

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

related to my answer to your other comment:getClient(null) returnsnull

static::fail(\sprintf('A client must be set to make assertions on it. Did you forget to call "%s::createClient"?',__CLASS__));
static$client;

if (0 <\func_num_args()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason to not useif ($newClient) {?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Because we want to be able to reset the state usinggetClient(null), whilegetClient() shouldn't reset anything

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems fair

@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@fabpotfabpot merged commit6253926 intosymfony:4.3Jun 6, 2019
fabpot added a commit that referenced this pull requestJun 6, 2019
…tionsTrait (nicolas-grekas)This PR was merged into the 4.3 branch.Discussion----------[FrameworkBundle] fix BC-breaking property in WebTestAssertionsTrait| Q             | A| ------------- | ---| Branch?       | 4.3| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#31653| License       | MIT| Doc PR        | -No properties should be exposed.Commits-------6253926 [FrameworkBundle] fix BC-breaking property in WebTestAssertionsTrait
@nicolas-grekasnicolas-grekas deleted the fix-webtestassertionstrait branchJune 6, 2019 08:36
@fabpotfabpot mentioned this pull requestJun 6, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

+1 more reviewer

@PierstovalPierstovalPierstoval left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

5 participants

@nicolas-grekas@OskarStark@Pierstoval@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp