* @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 );
}
public static function provideGetMessageFromException() {
+ Wikimedia\suppressWarnings();
+ $usageException = new UsageException(
+ '<b>Something broke!</b>', 'ue-code', 0, [ 'xxx' => 'yyy', 'baz' => 23 ]
+ );
+ Wikimedia\restoreWarnings();
+
return [
'Normal exception' => [
new RuntimeException( '<b>Something broke!</b>' ),
]
],
'UsageException' => [
- new UsageException( '<b>Something broke!</b>', 'ue-code', 0, [ 'xxx' => 'yyy', 'baz' => 23 ] ),
+ $usageException,
[],
[
'text' => '<b>Something broke!</b>',
]
],
'UsageException, wrapped' => [
- new UsageException( '<b>Something broke!</b>', 'ue-code', 0, [ 'xxx' => 'yyy', 'baz' => 23 ] ),
+ $usageException,
[ 'wrap' => 'parentheses', 'code' => 'some-code', 'data' => [ 'foo' => 'bar', 'baz' => 42 ] ],
[
'text' => '(<b>Something broke!</b>)',