Update suppressWarning()/restoreWarning() calls
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiMainTest.php
index ea33a9e..67d323f 100644 (file)
@@ -126,7 +126,7 @@ class ApiMainTest extends ApiTestCase {
                $priv = TestingAccessWrapper::newFromObject( $api );
                $priv->mInternalMode = false;
 
-               $module = $this->getMockBuilder( 'ApiBase' )
+               $module = $this->getMockBuilder( ApiBase::class )
                        ->setConstructorArgs( [ $api, 'mock' ] )
                        ->setMethods( [ 'getConditionalRequestData' ] )
                        ->getMockForAbstractClass();
@@ -223,7 +223,7 @@ class ApiMainTest extends ApiTestCase {
                $priv = TestingAccessWrapper::newFromObject( $api );
                $priv->mInternalMode = false;
 
-               $module = $this->getMockBuilder( 'ApiBase' )
+               $module = $this->getMockBuilder( ApiBase::class )
                        ->setConstructorArgs( [ $api, 'mock' ] )
                        ->setMethods( [ 'getConditionalRequestData' ] )
                        ->getMockForAbstractClass();
@@ -491,7 +491,7 @@ class ApiMainTest extends ApiTestCase {
                )->inLanguage( 'en' )->useDatabase( false )->text();
 
                $dbex = new DBQueryError(
-                       $this->createMock( 'IDatabase' ),
+                       $this->createMock( \Wikimedia\Rdbms\IDatabase::class ),
                        'error', 1234, 'SELECT 1', __METHOD__ );
                $dbtrace = wfMessage( 'api-exception-trace',
                        get_class( $dbex ),
@@ -500,6 +500,10 @@ class ApiMainTest extends ApiTestCase {
                        MWExceptionHandler::getRedactedTraceAsString( $dbex )
                )->inLanguage( 'en' )->useDatabase( false )->text();
 
+               Wikimedia\suppressWarnings();
+               $usageEx = new UsageException( 'Usage exception!', 'ue', 0, [ 'foo' => 'bar' ] );
+               Wikimedia\restoreWarnings();
+
                $apiEx1 = new ApiUsageException( null,
                        StatusValue::newFatal( new ApiRawMessage( 'An error', 'sv-error1' ) ) );
                TestingAccessWrapper::newFromObject( $apiEx1 )->modulePath = 'foo+bar';
@@ -545,7 +549,7 @@ class ApiMainTest extends ApiTestCase {
                                ]
                        ],
                        [
-                               new UsageException( 'Usage exception!', 'ue', 0, [ 'foo' => 'bar' ] ),
+                               $usageEx,
                                [ 'existing-error', 'ue' ],
                                [
                                        'warnings' => [