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

[BrowserKit] Bypass Header Informations#26791

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:masterfromCrowdfoxGmbH:headers_on_submit
Apr 22, 2018

Conversation

@ghost
Copy link

@ghostghost commentedApr 4, 2018
edited by fabpot
Loading

This enables browser Testingtools like mink to pass headerfiles while doing a form submit

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

We tried to do some Browsertesting with Mink and Behat, something like:

Scenario Outline: greet in native languageGiventhe browser language is"<lang>"AndI called the websiteWhenI fill in"PHP" for"username"AndI submit the formThenI should see"<greeting>"Examples:|lang |greeting ||en |Hello ||de |Hallo ||fr |Bonjour ||zh | 你好 ||ru | привет||be |Bonjour |
publicfunctiontheBrowserLanguageIs($arg1)    {$this->getSession()->setRequestHeader('Accept','*/*');$this->getSession()->setRequestHeader('Accept-Language',$arg1);    }

While everything works fine with visit form submit didn't send the headers. At Mink theres also an open issue for that
minkphp/MinkBrowserKitDriver#79

but actually the problem was between the mink browserkit and the symfony client.

* @return Crawler
*/
publicfunctionsubmit(Form$form,array$values =array())
publicfunctionsubmit(Form$form,array$values =array(),$serverParameters =array())
Copy link
Member

Choose a reason for hiding this comment

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

Instead of allowing to pass any server parameters, I think we should restrict to only HTTP headers. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

well, that's not consistent with therequest API, which expects to get things in the$_SERVER format. I think consistency is better for now.

Copy link
Member

Choose a reason for hiding this comment

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

Not sure I understand consistency here. Changing anything besides HTTP headers when submitting a form should not be allowed.

Copy link
Member

Choose a reason for hiding this comment

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

I mean, consistency between the different APIs of BrowserKit (namelyrequest andsubmit here)

Copy link
Author

Choose a reason for hiding this comment

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

I created the Pull Request to Mink BrowserKit to show the exakt usage for my usecase. Therefor I might leave it as it is. If you would prefer to filter parameters i can implement that as well

ghost pushed a commit to CrowdfoxGmbH/MinkBrowserKitDriver that referenced this pull requestApr 5, 2018
@ghost
Copy link
Author

Is there something i can to about the failed test AppVeyor?

@fabpot
Copy link
Member

As this is a new feature, this pull request should be rebased on master.

@nicolas-grekasnicolas-grekas added this to the4.1 milestoneApr 6, 2018
This enables browser Testingtools like mink to pass headerfiles while doing a form submmit
@ghost ghostforce-pushed theheaders_on_submit branch from45148fa tofa2063eCompareApril 6, 2018 10:54
@ghost
Copy link
Author

We rebased but the master test is still failing.

@fabpotfabpot changed the base branch from2.7 tomasterApril 20, 2018 04:37
@fabpotfabpot closed thisApr 22, 2018
@fabpotfabpot reopened thisApr 22, 2018
@fabpot
Copy link
Member

Thank you@CFJulien.

@fabpotfabpot merged commitfa2063e intosymfony:masterApr 22, 2018
fabpot added a commit that referenced this pull requestApr 22, 2018
This PR was merged into the 4.1-dev branch.Discussion----------[BrowserKit] Bypass Header InformationsThis enables browser Testingtools like mink to pass headerfiles while doing a form submit| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets || License       | MIT| Doc PR        |<!--Write a short README entry for your feature/bugfix here (replace this comment block.)This will help people understand your PR and can be used as a start of the Doc PR.Additionally: - Bug fixes must be submitted against the lowest branch where they apply   (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the master branch.-->We tried to do some Browsertesting with Mink and Behat, something like:```gherkinScenario Outline: greet in native languageGiven the browser language is "<lang>"And I called the websiteWhen I fill in "PHP" for "username"And I submit the formThen I should see "<greeting>"Examples:| lang | greeting || en | Hello || de | Hallo || fr | Bonjour || zh | 你好 || ru | привет|| be | Bonjour |``````php  public function theBrowserLanguageIs($arg1)    {        $this->getSession()->setRequestHeader('Accept', '*/*');        $this->getSession()->setRequestHeader('Accept-Language', $arg1);    }```While everything works fine with visit form submit didn't send the headers. At Mink theres also an open issue for thatminkphp/MinkBrowserKitDriver#79but actually the problem was between the mink browserkit and the symfony client.Commits-------fa2063e [BroserKit] Enable passthrew header information on submit
@fabpotfabpot mentioned this pull requestMay 7, 2018
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

4.1

Development

Successfully merging this pull request may close these issues.

5 participants

@fabpot@stof@nicolas-grekas@carsonbot@CFJulien

[8]ページ先頭

©2009-2025 Movatter.jp