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.
Splitting this off from #2982149: Routing: Convert system functional tests to phpunit, that is getting too big. Please credit the people that worked on that.
scope:
./Session/SessionAuthenticationTest.php
./Session/SessionTest.php
./Session/StackSessionHandlerIntegrationTest.php
split:
./Session/SessionHttpsTest.php
Comment | File | Size | Author |
---|---|---|---|
#18 | 3002121-18.patch | 14.85 KB | Lendude |
#18 | interdiff-3002121-16-18.txt | 3.53 KB | Lendude |
#16 | 3002121-16.patch | 14.44 KB | Lendude |
#16 | interdiff-3002121-14-16.txt | 1.74 KB | Lendude |
#14 | 3002121-14.patch | 14.47 KB | Lendude |
Comments
Comment #2
Lendudecopy of the relevant parts from hte other issue
Comment #4
LendudeThis is just to get this moving, not everything will pass yet.
Couple of things I see:
If I turn this into a proper test for the cookie and not some header, it fails
But it's unclear to me why we are testing this and why we want this to be true.....
This is attempting to test 'Session data persists through browser close.', but its just switching cookie jars in WTB, so its really testing that temp files persist though curl_close, which doesn't really test anything I feel. Simulating a browser close is hard, haven't figured out how to do that. (but the WTB way isn't it)
Comment #6
LendudeSome more passing tests. Looks like Mink stores stuff in the session that messes things up after using basic auth, I can't reproduce the problems in a normal browser.
Comment #8
LendudeSplit of #3011079: Convert \Drupal\system\Tests\Session\SessionHttpsTest to PHPUnit that test has way too much history for a simple conversion, see #2265099: Cleanup SessionHttpsTest and fix redirect to non-existing URL after POST requests
The rest should be green, but need to look into some commented out stuff.
Comment #9
LendudeBack to 'needs work' for the commented bits.
Comment #10
LendudeThis re-adds the 'browser close' test, but the coverage is just as dodgy as the Simpletest version. Since retaining cookies on browser close is browser behaviour and not Drupal behaviour, I'm not 100% convinced this is needed at all, but added here to keep the conversion 1-to-1
The HttpOnly assertion still fails. No idea why that is different then the Simpletest version, will dig a little more.
Comment #12
Lendude\GuzzleHttp\Cookie\SetCookie::getHttpOnly always returns false with our test setup (don't know why), so a nice way of checking this is not available, so I replicated the header check from the WTB version, but it doesn't work with using login, but it does work with another page.
Green locally now.
Comment #13
jibranThis is super complex stuff.
WoW.
We have \Drupal\Core\Test\FunctionalTestSetupTrait::writeSettings for this.
Comment #14
Lendude@jibran nice catch. The call to writeSettings was also done, the one call to settingsSet wasn't needed at all to make this pass, so took it out.
Comment #15
borisson_Nitpicks ahead :)
Do we know what that information is? Because adding that in sounds like a good improvement. If we don't this comment is good enough I think :)
This method name and description don't really fit together. We should probably either make the function name more narrow, or the description more broad. I think the second makes more sense.
Also, there are no types for the parameters. We should add those (string, mixed - I think?)
This can just be {@inheritdoc}
Comment #16
Lendude#15.1 Not a clue. It would redirect all traffic to 'user/2', which would then give a 403. *shrug*
#15.2 same as #13 really, we can just leave it out completely
#15.3 fixed, also updated it to protected.
Comment #17
jibranSome more nits.
$this->getSession() can be a local var.
Same as above.
Comment #18
LendudeNits addressed.
Comment #19
jibranThanks, this looks good now.
Comment #20
alexpottCommitted 6d3fbe9 and pushed to 8.7.x. Thanks!
Committed 472574a and pushed to 8.6.x. Thanks!
Fixed unused on commit.