X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fsession%2FCookieSessionProviderTest.php;h=73485c828c6072e0173a08a809932cc8802ad192;hp=da4b06ec831af8b11e2c759aa64be1306a03f4d6;hb=424251a2cb5842727756d96f877c787c443ea056;hpb=d3a51a690c977efe2d97f911f279a4ac791a8e83 diff --git a/tests/phpunit/includes/session/CookieSessionProviderTest.php b/tests/phpunit/includes/session/CookieSessionProviderTest.php index da4b06ec83..73485c828c 100644 --- a/tests/phpunit/includes/session/CookieSessionProviderTest.php +++ b/tests/phpunit/includes/session/CookieSessionProviderTest.php @@ -414,7 +414,9 @@ class CookieSessionProviderTest extends MediaWikiTestCase { ); \TestingAccessWrapper::newFromObject( $backend )->usePhpSessionHandling = false; - $mock = $this->getMock( 'stdClass', [ 'onUserSetCookies' ] ); + $mock = $this->getMockBuilder( 'stdClass' ) + ->setMethods( [ 'onUserSetCookies' ] ) + ->getMock(); $mock->expects( $this->never() )->method( 'onUserSetCookies' ); $this->mergeMwGlobalArrayValue( 'wgHooks', [ 'UserSetCookies' => [ $mock ] ] ); @@ -560,13 +562,15 @@ class CookieSessionProviderTest extends MediaWikiTestCase { } protected function getSentRequest() { - $sentResponse = $this->getMock( 'FauxResponse', [ 'headersSent', 'setCookie', 'header' ] ); + $sentResponse = $this->getMockBuilder( 'FauxResponse' ) + ->setMethods( [ 'headersSent', 'setCookie', 'header' ] )->getMock(); $sentResponse->expects( $this->any() )->method( 'headersSent' ) ->will( $this->returnValue( true ) ); $sentResponse->expects( $this->never() )->method( 'setCookie' ); $sentResponse->expects( $this->never() )->method( 'header' ); - $sentRequest = $this->getMock( 'FauxRequest', [ 'response' ] ); + $sentRequest = $this->getMockBuilder( 'FauxRequest' ) + ->setMethods( [ 'response' ] )->getMock(); $sentRequest->expects( $this->any() )->method( 'response' ) ->will( $this->returnValue( $sentResponse ) ); return $sentRequest; @@ -603,7 +607,8 @@ class CookieSessionProviderTest extends MediaWikiTestCase { \TestingAccessWrapper::newFromObject( $backend )->usePhpSessionHandling = false; // Anonymous user - $mock = $this->getMock( 'stdClass', [ 'onUserSetCookies' ] ); + $mock = $this->getMockBuilder( 'stdClass' ) + ->setMethods( [ 'onUserSetCookies' ] )->getMock(); $mock->expects( $this->never() )->method( 'onUserSetCookies' ); $this->mergeMwGlobalArrayValue( 'wgHooks', [ 'UserSetCookies' => [ $mock ] ] ); $backend->setUser( $anon ); @@ -621,7 +626,8 @@ class CookieSessionProviderTest extends MediaWikiTestCase { $provider->persistSession( $backend, $this->getSentRequest() ); // Logged-in user, no remember - $mock = $this->getMock( __CLASS__, [ 'onUserSetCookies' ] ); + $mock = $this->getMockBuilder( __CLASS__ ) + ->setMethods( [ 'onUserSetCookies' ] )->getMock(); $mock->expects( $this->once() )->method( 'onUserSetCookies' ) ->will( $this->returnCallback( function ( $u, &$sessionData, &$cookies ) use ( $user ) { $this->assertSame( $user, $u ); @@ -664,7 +670,8 @@ class CookieSessionProviderTest extends MediaWikiTestCase { $provider->persistSession( $backend, $this->getSentRequest() ); // Logged-in user, remember - $mock = $this->getMock( __CLASS__, [ 'onUserSetCookies' ] ); + $mock = $this->getMockBuilder( __CLASS__ ) + ->setMethods( [ 'onUserSetCookies' ] )->getMock(); $mock->expects( $this->once() )->method( 'onUserSetCookies' ) ->will( $this->returnCallback( function ( $u, &$sessionData, &$cookies ) use ( $user ) { $this->assertSame( $user, $u );