From 8a4f10931d2cf13b9a8166104447a3aaa86c8606 Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Tue, 17 May 2016 23:14:00 -0700 Subject: [PATCH] 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 --- tests/phpunit/includes/session/PHPSessionHandlerTest.php | 8 -------- 1 file changed, 8 deletions(-) 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(); -- 2.20.1