Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
WebTestBase uses the cookies from the request object. But we create that from scratch in test setup, it never contains those cookies anymore.
Proposed resolution
Go back to using using $_COOKIE directly.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#8 | Selection_002.png | 223.42 KB | juampynr |
#6 | debugging_test_child-2552267-5.patch | 798 bytes | rocketeerbkw |
#2 | xdebug-cookie-2552267-2.patch | 792 bytes | Berdir |
Comments
Comment #2
BerdirI'm not sure if BrowserTestBase needs to be changed as well.
Comment #3
dawehnerWe should certainly at least document why we use
$_COOKIE
hereComment #4
jibranWhere can I read the documents about this? I know this feature is there but I don't know how to use this.
Comment #5
rocketeerbkw CreditAttribution: rocketeerbkw commented\Drupal::request()
returns the last request on the request stack (Symfony\Component\HttpFoundation\RequestStack
). When I was debugging this, the stack had at least 5 request objects in it, none of the later ones had cookies.I don't know why there are so many, but I know that the first one in the stack has all the cookies in it, so I changed the code to get the first request object in the stack. This fixed it for me, and it doesn't have to use
$_COOKIE
global.Comment #6
rocketeerbkw CreditAttribution: rocketeerbkw commentedComment #8
juampynr CreditAttribution: juampynr at Lullabot commentedI just verified that the patch at #6 gets the cookie information from the master request:
However, I don't know what to set to the XDEBUG_SESSION cookie so the correct info is then added to get/post request to the child site. I tried running
document.cookie="document.cookie="XDEBUG_SESSION=xdebug;path=/";
just before clicking "Run tests" and even though I can see the cookie in the above screenshot, this does not add the XDEBUG_SESSION_START parameter to child requests.@rocketeerbkw, how do you do it?
On a side note, once we fix this issue we should update [#30011]
Comment #10
juampynr CreditAttribution: juampynr at Lullabot commentedSince I changed to PHPStorm I am not facing this error again by upping the Number of connection settings. Shall we close this issue?
@rocketeerbkw, do you still experience this issue?
Comment #18
quietone CreditAttribution: quietone as a volunteer commentedTriaging issues in simpletest.module as part of the Bug Smash Initiative to determine if they should be in the Simpletest Project or core.
This looks like it a Phpunit issue, changing component.
Comment #19
mondrakeWell this one seems definitely outdated. If still applies for BrowserTestBase, please ipen a new issue.