X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fapi%2FApiMainTest.php;h=67d323f086cf033079b2822fe3420cd883978c58;hb=39f0f919c5708f4c672a8eb7e0891f50bf16883e;hp=ea33a9e3adaa92a917b33b509b4ad3dd542d31b8;hpb=853b17ef5788be25045855ab340c9e0d8b443218;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/api/ApiMainTest.php b/tests/phpunit/includes/api/ApiMainTest.php index ea33a9e3ad..67d323f086 100644 --- a/tests/phpunit/includes/api/ApiMainTest.php +++ b/tests/phpunit/includes/api/ApiMainTest.php @@ -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' => [