From: Ori Livneh Date: Wed, 18 May 2016 06:14:00 +0000 (-0700) Subject: Remove a test case from PHPSessionHandlerTest::testSessionHandling() X-Git-Tag: 1.31.0-rc.0~6738^2 X-Git-Url: https://git.cyclocoop.org//%22?a=commitdiff_plain;h=8a4f10931d2cf13b9a8166104447a3aaa86c8606;p=lhc%2Fweb%2Fwiklou.git Remove a test case from PHPSessionHandlerTest::testSessionHandling() The test sleeps for nine seconds (3 invocations, 3 seconds per invocation) which is difficult to sit through. The test code sets the value of two PHP parameters, session.gc_divisor and session.gc_probability, to 1. This may be to ensure that PHP will invoke the session handler's gc() method when the call is made to session_start() below. But the call to PHPSessionHandler::gc() is immaterial, for two reasons: - PHPSessionHandler::gc() evicts items by calling the deleteObjectsExpiringBefore() on the BagOStuff instance it uses for storage. The only BagOStuff implementation that actually uses that method to evict items is SqlBagOStuff, which we're not using here, and which would be an odd choice of a storage backend for sessions. - PHP calls SessionHandler::gc() _after_ opening the new (or resumed) session and loading its data, so even if deleteObjectsExpiringBefore() actually did anything, it would not influence the result of the test. Bug: T135576 Change-Id: I6e153ec8bfa5972ed45a0e6b7720832692b952fb --- diff --git a/tests/phpunit/includes/session/PHPSessionHandlerTest.php b/tests/phpunit/includes/session/PHPSessionHandlerTest.php index ce0f1b0611..799a97bbb1 100644 --- a/tests/phpunit/includes/session/PHPSessionHandlerTest.php +++ b/tests/phpunit/includes/session/PHPSessionHandlerTest.php @@ -173,14 +173,6 @@ class PHPSessionHandlerTest extends MediaWikiTestCase { $this->assertSame( $expect, $_SESSION ); } - // Test expiry - session_write_close(); - ini_set( 'session.gc_divisor', 1 ); - ini_set( 'session.gc_probability', 1 ); - sleep( 3 ); - session_start(); - $this->assertSame( [], $_SESSION ); - // Re-fill the session, then test that session_destroy() works. $_SESSION['AuthenticationSessionTest'] = $rand; session_write_close();