X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fapi%2FApiErrorFormatterTest.php;h=aa579ab01493ff2c6e1f630deea0b751bd4ad53e;hb=6f9c30c67b31b12d39f2d54b431e141869895eca;hp=a2c0d3978e45737efa28bd2daaa6a94bfd4005d4;hpb=2ecb96a96fdd62b2521b6d9ac2d5e2dac0eba0ec;p=lhc%2Fweb%2Fwiklou.git
diff --git a/tests/phpunit/includes/api/ApiErrorFormatterTest.php b/tests/phpunit/includes/api/ApiErrorFormatterTest.php
index a2c0d3978e..aa579ab014 100644
--- a/tests/phpunit/includes/api/ApiErrorFormatterTest.php
+++ b/tests/phpunit/includes/api/ApiErrorFormatterTest.php
@@ -526,6 +526,10 @@ class ApiErrorFormatterTest extends MediaWikiLangTestCase {
* @param array $expect
*/
public function testGetMessageFromException( $exception, $options, $expect ) {
+ if ( $exception instanceof UsageException ) {
+ $this->hideDeprecated( 'UsageException::getMessageArray' );
+ }
+
$result = new ApiResult( 8388608 );
$formatter = new ApiErrorFormatter( $result, Language::factory( 'en' ), 'html', false );
@@ -571,6 +575,12 @@ class ApiErrorFormatterTest extends MediaWikiLangTestCase {
}
public static function provideGetMessageFromException() {
+ Wikimedia\suppressWarnings();
+ $usageException = new UsageException(
+ 'Something broke!', 'ue-code', 0, [ 'xxx' => 'yyy', 'baz' => 23 ]
+ );
+ Wikimedia\restoreWarnings();
+
return [
'Normal exception' => [
new RuntimeException( 'Something broke!' ),
@@ -591,7 +601,7 @@ class ApiErrorFormatterTest extends MediaWikiLangTestCase {
]
],
'UsageException' => [
- new UsageException( 'Something broke!', 'ue-code', 0, [ 'xxx' => 'yyy', 'baz' => 23 ] ),
+ $usageException,
[],
[
'text' => '<b>Something broke!</b>',
@@ -600,7 +610,7 @@ class ApiErrorFormatterTest extends MediaWikiLangTestCase {
]
],
'UsageException, wrapped' => [
- new UsageException( 'Something broke!', 'ue-code', 0, [ 'xxx' => 'yyy', 'baz' => 23 ] ),
+ $usageException,
[ 'wrap' => 'parentheses', 'code' => 'some-code', 'data' => [ 'foo' => 'bar', 'baz' => 42 ] ],
[
'text' => '(<b>Something broke!</b>)',