X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fsession%2FPHPSessionHandlerTest.php;h=34e5e449a307a0423c986d1f6847e180882d3881;hb=dfaa26a7b19ab65190a76cd32259a3637cc3e2fd;hp=ce0f1b0611b7b9d57450ab2854e1a2fa733e220e;hpb=6fa889309d6dde3bcfd1c5f939e317abf0f3e790;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/session/PHPSessionHandlerTest.php b/tests/phpunit/includes/session/PHPSessionHandlerTest.php index ce0f1b0611..34e5e449a3 100644 --- a/tests/phpunit/includes/session/PHPSessionHandlerTest.php +++ b/tests/phpunit/includes/session/PHPSessionHandlerTest.php @@ -21,7 +21,7 @@ class PHPSessionHandlerTest extends MediaWikiTestCase { } return false; } ); - $reset[] = new \ScopedCallback( 'restore_error_handler' ); + $reset[] = new \Wikimedia\ScopedCallback( 'restore_error_handler' ); $rProp = new \ReflectionProperty( PHPSessionHandler::class, 'instance' ); $rProp->setAccessible( true ); @@ -30,7 +30,7 @@ class PHPSessionHandlerTest extends MediaWikiTestCase { $oldManager = $old->manager; $oldStore = $old->store; $oldLogger = $old->logger; - $reset[] = new \ScopedCallback( + $reset[] = new \Wikimedia\ScopedCallback( [ PHPSessionHandler::class, 'install' ], [ $oldManager, $oldStore, $oldLogger ] ); @@ -49,7 +49,7 @@ class PHPSessionHandlerTest extends MediaWikiTestCase { $rProp = new \ReflectionProperty( PHPSessionHandler::class, 'instance' ); $rProp->setAccessible( true ); - $reset = new \ScopedCallback( [ $rProp, 'setValue' ], [ $rProp->getValue() ] ); + $reset = new \Wikimedia\ScopedCallback( [ $rProp, 'setValue' ], [ $rProp->getValue() ] ); $rProp->setValue( $handler ); $handler->setEnableFlags( 'enable' ); @@ -123,7 +123,7 @@ class PHPSessionHandlerTest extends MediaWikiTestCase { ] ); PHPSessionHandler::install( $manager ); $wrap = \TestingAccessWrapper::newFromObject( $rProp->getValue() ); - $reset[] = new \ScopedCallback( + $reset[] = new \Wikimedia\ScopedCallback( [ $wrap, 'setEnableFlags' ], [ $wrap->enable ? $wrap->warn ? 'warn' : 'enable' : 'disable' ] ); @@ -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(); @@ -334,7 +326,7 @@ class PHPSessionHandlerTest extends MediaWikiTestCase { \TestingAccessWrapper::newFromObject( $handler )->setEnableFlags( 'disable' ); $oldValue = $rProp->getValue(); $rProp->setValue( $handler ); - $reset = new \ScopedCallback( [ $rProp, 'setValue' ], [ $oldValue ] ); + $reset = new \Wikimedia\ScopedCallback( [ $rProp, 'setValue' ], [ $oldValue ] ); call_user_func_array( [ $handler, $method ], $args ); }