Closed (fixed)
Project:
Drupal core
Version:
8.4.x-dev
Component:
rest.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
11 Feb 2017 at 15:52 UTC
Updated:
4 Mar 2017 at 09:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
berdirComment #3
wim leersThanks! This is very helpful. Although I personally almost never get xdebug session cookie-based debugging of tests working. But if this works for you, great.
All of this, we only do to support sending the Xdebug cookie header.
But where does this cookie header then get set? AFAICT it's these snippets in
BrowserTestBase:Can we move all this logic to a protected helper method, that is called from this method? That helper method can then have a name such as
decorateWithXdebugCookie().Most requests performed by this logic do NOT actually need/want cookies. So it's currently very confusing/misleading.
Comment #4
berdirThe cookie needs to be sent with *every* request. That's how cookies work :)
That workaround there is to be able to call setCookie() later on, that has actually nothing to do with what we are doing, that's just working around Mink/WebDriver's validation within setCookie() as far as I understand.
I know the code there is ugly, the problem is that every usage of XdebugRequestTrait looks different, WebTestBase needs to interact with curl, normal BrowserTestBase set cookies with setCookie() which eventually creates a CookieJar in BrowserKit this needs to mess with a cookie string (As I said, a CookieJar would be nicer, but it would be a Guzzle CookieJar, which again works completely different to BrowserKit).
Happy to move it into a helper method, this was just a quick proof of concept. If we refactor how cookies work, then we can actually make this nicer and don't need to manually mess with the cookie header.
Comment #5
wim leersYes, but… when somebody is debugging a test using Basic Auth or OAuth2 or even anonymous, then it doesn't make sense to A) see a cookie, B) see a shitton of code relating to cookies for every single request. That's why I'm asking to put that logic in a separate helper method.
That sounds good. But at the same time: it doesn't matter. What matters is that "Xdebug cookie" stuff is in a helper method. I don't care how ugly it is :)
Comment #6
berdirSure, I just had enough time explain why things are so complicated/duplicated everywhere and not to update the patch, but wanted to do that.
This better?
Comment #7
wim leersYes, thanks! :)
Comment #8
alexpottCommitted and pushed 89b381f to 8.4.x and a33fb89 to 8.3.x. Thanks!
Backported to 8.3.x since debuggability in testing is important and this is a test-only change in tests that have changed heaps in 8.3.0.
Remove unused use statements.