Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[WIP]BrowserKit] added a test to make sure HTTP authentication is preserved #7059

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 17, 2013

Conversation

sstok
Copy link
Contributor

@sstok sstok commented Feb 13, 2013

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? no
Fixed tickets
License MIT
Doc PR

Since #6995 BrowseKit no longer seems to preserve the HTTP authentication when submitting a form. This PR adds a test to demonstrate the failure.

$crawler = $client->request('GET', 'http://www.example.com/foo/foobar', array(), array(), array('PHP_AUTH_USER' => 'foo', 'PHP_AUTH_PW' => 'bar'));

$server = $client->getRequest()->getServer();
$this->assertTrue(isset($server['PHP_AUTH_USER']));
Copy link
Member

Choose a reason for hiding this comment

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

``assertArrayHasKey will give a better failure message

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't know this method existed :) thanks 👍

@vicb
Copy link
Contributor

vicb commented Feb 13, 2013

Thanks. Could you add a "[WIP]" prefix to the PR tittle and set "bug fix" to "no" for now ?

@sstok
Copy link
Contributor Author

sstok commented Feb 13, 2013

done 👍

@fabpot
Copy link
Member

fabpot commented Feb 17, 2013

This cannot be related to #6995 as your test does not involve any HttpFoundation classes.

fabpot added a commit that referenced this pull request Feb 17, 2013
This PR was merged into the 2.2 branch.

Commits
-------

b240d1f [BrowserKit] added a test to make sure HTTP authentication is preserved when submitting a form

Discussion
----------

[WIP]BrowserKit] added a test to make sure HTTP authentication is preserved

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | no
| Fixed tickets |
| License       | MIT
| Doc PR        |

Since #6995 BrowseKit no longer seems to preserve the HTTP authentication when submitting a form. This PR adds a test to demonstrate the failure.

---------------------------------------------------------------------------

by vicb at 2013-02-13T12:49:16Z

Thanks. Could you add a "[WIP]" prefix to the PR tittle and set "bug fix" to "no" for now ?

---------------------------------------------------------------------------

by sstok at 2013-02-13T13:59:42Z

done :+1:

---------------------------------------------------------------------------

by fabpot at 2013-02-17T12:49:35Z

This cannot be related to #6995 as your test does not involve any HttpFoundation classes.
@fabpot fabpot merged commit b240d1f into symfony:2.2 Feb 17, 2013
@fabpot
Copy link
Member

fabpot commented Feb 17, 2013

See 5bf6d7e for how to keep authentication between requests.

@sstok
Copy link
Contributor Author

sstok commented Feb 17, 2013

@fabpot True, but because of the change done in #6995 this was no longer working.
The URL does not contain the authentication information so it is stripped.

Thanks for the tip! 👍

@fabpot
Copy link
Member

fabpot commented Feb 17, 2013

@sstok: Again, your test was not passing on any Symfony version. So #6995 is irrelevant here. If there is a bug (and apparently there is one), we need to find another test that proves it.

@sstok
Copy link
Contributor Author

sstok commented Feb 17, 2013

The recommendation you gave for 5bf6d7e works perfect.

"your test was not passing on any Symfony version."
OK.. this was the simplest thing I could come up with, and what was actually failing. I did not test it with other versions.

I pointed to the #6995 because this was the only change that was made after the version I'm using (6c00ffe) that has anything to do with this issue. I'm not sure this change was the cause but is seemed it was.

@sstok sstok deleted the browserkit-client-http-auth branch February 17, 2013 13:26
@fabpot
Copy link
Member

fabpot commented Feb 17, 2013

What I meant is that the bug might still exist, and so, we probably need to figure it out.

fabpot added a commit that referenced this pull request Feb 18, 2013
* 2.2: (22 commits)
  [Process] Fix regression introduced in #6620 / 880da01, fixes #7082
  [HttpKernel] added a unit for the previous commit (closes #7025)
  [HttpFoundation] fixed, overwritten CONTENT_TYPE
  [BrowserKit] fixed test added in the previous merge (refs #7059)
  [FrameworkBundle] tweaked reference dumper command (see #7093)
  Remove unnecessary comment and change test name
  [Config] tweaked dumper to indent multi-line info
  [HttpKernel] added some tests for previous merge
  Fix REMOTE_ADDR for cached subrequests
  [FrameworkBundle] CSRF should be on by default
  [WebProfilerBundle] removed dependency on FrameworkBundle (closes #6949)
  [HttpKernel] added error display suppression when using the ErrorHandler (if not, errors are displayed twice, refs #6254)
  [HttpFoundation] tweaked previous merge
  [HttpFoundation] Added getter for httpMethodParameterOverride state
  Create validators.lv.xlf
  [Process] Warn user with a useful message when tmpfile() failed
  [BrowserKit] added a test to make sure HTTP authentication is preserved when submitting a form
  Remove array type hint from GetResponseForControllerResultEvent::setControllerResult()
  bumped Symfony version to 2.2.0-DEV
  Revert "merged branch povilas/issue_6101 (PR #6708)"
  ...
ostrolucky pushed a commit to ostrolucky/symfony that referenced this pull request Mar 25, 2018
* 2.2: (22 commits)
  [Process] Fix regression introduced in symfony#6620 / 880da01, fixes symfony#7082
  [HttpKernel] added a unit for the previous commit (closes symfony#7025)
  [HttpFoundation] fixed, overwritten CONTENT_TYPE
  [BrowserKit] fixed test added in the previous merge (refs symfony#7059)
  [FrameworkBundle] tweaked reference dumper command (see symfony#7093)
  Remove unnecessary comment and change test name
  [Config] tweaked dumper to indent multi-line info
  [HttpKernel] added some tests for previous merge
  Fix REMOTE_ADDR for cached subrequests
  [FrameworkBundle] CSRF should be on by default
  [WebProfilerBundle] removed dependency on FrameworkBundle (closes symfony#6949)
  [HttpKernel] added error display suppression when using the ErrorHandler (if not, errors are displayed twice, refs symfony#6254)
  [HttpFoundation] tweaked previous merge
  [HttpFoundation] Added getter for httpMethodParameterOverride state
  Create validators.lv.xlf
  [Process] Warn user with a useful message when tmpfile() failed
  [BrowserKit] added a test to make sure HTTP authentication is preserved when submitting a form
  Remove array type hint from GetResponseForControllerResultEvent::setControllerResult()
  bumped Symfony version to 2.2.0-DEV
  Revert "merged branch povilas/issue_6101 (PR symfony#6708)"
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants