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
Now that #2232861: Create BrowserTestBase for web-testing on top of Mink the path is clear to write a BrowserKit based driver that uses the kernel to simulate web requests - aka Look Ma no http.
Proposed resolution
Write a new BrowserKit based driver (we just need to sub-class and implement doRequest method).
Write a KernelWebTestBase class that uses said driver.
Write a sample test that uses KernelWebTestBase to test Request/Response without http.
Remaining tasks
Everything
User interface changes
None
API changes
New testing class
Comment | File | Size | Author |
---|---|---|---|
#10 | step_3_create_a-2469717-10.patch | 1.14 KB | larowlan |
Comments
Comment #1
chx CreditAttribution: chx at Tag1 Consulting commentedThis is an incredibly dangerous move -- look ma, we do not find the Drupal - web server interaction bugs any more (Wasn't there an issue within the last two weeks where Apache is fine with two HTTP Accept headers and appends them together while nginx will send only the second one. Opsie.). I wonder whether it'd be possible for the test runner to pick so that drupalci could run web servers rarely and the speedier no-http versions all the time.
Comment #2
grom358 CreditAttribution: grom358 commentedIs this still block by exit calls in core? Or have they all been removed now?
Also I don't think like with JavascriptTestBase we need a subclass for this. Should be able to have the no-http driver registered on the mink session. This avoids the problem @chx mentions. Could choose to use no-http as the default and switch to a http driver to detect HTTP interaction bugs.
Comment #3
dawehnerThere is already such a driver out there, see
\Symfony\Component\HttpKernel\Client
Comment #5
xjmIs this issue a duplicate/obsolete?
Comment #6
dawehnerWell, IMHO this is something we could try out once we have all our tests converted over. It could conceptually bring quite a speed difference, but more important, it would ensure that we leak less things per request. On top of that, this issue is correctly prioritiesed as normal.
Comment #9
larowlanNow #2829346: Allow repeated calls to DrupalKernel::setSitePath() is in, this is now unblocked again I think.
Played around with it for an hour or so tonight, but not much joy.
Basically, our drupalUserIsLoggedIn method isn't finding the session in the session storage, despite the login working (as seen in the html output). So something about mixing the two kernels.
Not worth putting a patch up.
Comment #10
larowlanIn case someone else wants to poke about
Comment #11
dawehnerAre you sure that at least the simpletest cookie workes? This is the steps I always struggled with.
Comment #12
larowlanThe html output shows the logged in user, but yeah could be the cookie, didn't think of that
Comment #13
dawehnerNote: #1497162: Eliminate the use of exit in core might still be a problem here.