X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fsession%2FPHPSessionHandlerTest.php;h=fdaa336dbdbbfd3a5b3d88358ee23a9187742ffe;hb=17d8a57bde68073290f4b548ad28658181a11d0e;hp=28fc04adedc7aad1b1f8f9f51530e4eafe81429a;hpb=c1edd28ba660411ecc4207533d522926c82913fc;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/session/PHPSessionHandlerTest.php b/tests/phpunit/includes/session/PHPSessionHandlerTest.php index 28fc04aded..fdaa336dbd 100644 --- a/tests/phpunit/includes/session/PHPSessionHandlerTest.php +++ b/tests/phpunit/includes/session/PHPSessionHandlerTest.php @@ -15,15 +15,6 @@ class PHPSessionHandlerTest extends MediaWikiTestCase { private function getResetter( &$rProp = null ) { $reset = []; - // Ignore "headers already sent" warnings during this test - set_error_handler( function ( $errno, $errstr ) use ( &$warnings ) { - if ( preg_match( '/headers already sent/', $errstr ) ) { - return true; - } - return false; - } ); - $reset[] = new \Wikimedia\ScopedCallback( 'restore_error_handler' ); - $rProp = new \ReflectionProperty( PHPSessionHandler::class, 'instance' ); $rProp->setAccessible( true ); if ( $rProp->getValue() ) { @@ -80,7 +71,10 @@ class PHPSessionHandlerTest extends MediaWikiTestCase { ini_set( 'session.use_trans_sid', 1 ); $store = new TestBagOStuff(); - $logger = new \TestLogger(); + // Tolerate debug message, anything else is unexpected + $logger = new \TestLogger( false, function ( $m ) { + return preg_match( '/^SessionManager using store/', $m ) ? null : $m; + } ); $manager = new SessionManager( [ 'store' => $store, 'logger' => $logger, @@ -126,7 +120,7 @@ class PHPSessionHandlerTest extends MediaWikiTestCase { $wrap = TestingAccessWrapper::newFromObject( $rProp->getValue() ); $reset[] = new \Wikimedia\ScopedCallback( [ $wrap, 'setEnableFlags' ], - [ $wrap->enable ? $wrap->warn ? 'warn' : 'enable' : 'disable' ] + [ $wrap->enable ? ( $wrap->warn ? 'warn' : 'enable' ) : 'disable' ] ); $wrap->setEnableFlags( 'warn' ); @@ -156,6 +150,7 @@ class PHPSessionHandlerTest extends MediaWikiTestCase { $expect = [ 'AuthenticationSessionTest' => $rand ]; session_write_close(); $this->assertSame( [ + [ LogLevel::DEBUG, 'SessionManager using store MediaWiki\Session\TestBagOStuff' ], [ LogLevel::WARNING, 'Something wrote to $_SESSION!' ], ], $logger->getBuffer() );