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] Add BrowserKitAssertionsTrait::assertThatForBrowser#42526

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
fabpot merged 1 commit intosymfony:5.4fromkoenreiniers:assert-for-browser
Aug 26, 2021

Conversation

@koenreiniers
Copy link
Contributor

@koenreinierskoenreiniers commentedAug 13, 2021
edited
Loading

QA
Branch?5.4
Bug fix?no
New feature?yes
Deprecations?no
Tickets-
LicenseMIT
Doc PR-

I wanted to create a constraint that acts on the request and the response (an openapi schema validator constraint that needs the method and pathinfo from the request and the body from the response). But, there is currently no way to get the current client, sinceBrowserKitAssertionsTrait::getClient is private and there is no method to do an assertion on the client/browser (likeBrowserKitAssertionsTrait::assertThatForResponse for the response).

This small change will allow to do the following:

protected static function assertResponseMatchesOpenApiSchema(): void{    self::assertThatForBrowser(new ResponseMatchesOpenApiSchema(self::getOpenApiValidator()));}

@fabpot
Copy link
Member

When you are calling your assertion in a test, you do have access to the current client, so I don't see the benefit of this new method (which makes difficult to understand what's going on IMHO).

@nep-koen
Copy link

Yes I agree that the benefits are small, though someone at some points made the decision to be able to call browser kit assertions without passing any arguments, instead acting on the internal state of the test class (e.g.self::assertResponseIsSuccessful(),self::assertBrowserHasCookie(..), etc.).

For the sake of consistency I would like to be able to do the same for my own assertions (e.g.self::assertResponseMatchesOpenApiSchema() instead ofself::assertResponseMatchesOpenApiSchema($client) orself::assertResponseMatchesOpenApiSchema($method, $path).

If I hadn't needed the request method and path this would have been completely possible usingBrowserKitAssertions::assertThatForResponse(), which does the same thing for theResponse object as the newBrowserKitAssertions::assertThatForBrowser() method does for theAbstractBrowser.

Copy link
Member

@fabpotfabpot left a comment

Choose a reason for hiding this comment

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

Ok, fair enough, that makes sense to me. Can you rename the method to be consistent with the current naming?

@fabpot
Copy link
Member

Thank you@koenreiniers.

sstok reacted with hooray emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

5 participants

@koenreiniers@fabpot@nep-koen@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp