<?php
+use Wikimedia\TestingAccessWrapper;
+
/**
* @group API
+ * @group Database
* @group medium
*
* @covers ApiMain
}
public static function provideApiErrorFormatterCreation() {
- global $wgContLang;
-
return [
'Default (BC)' => [ [], [
'uselang' => 'ru',
'uselang=content' => [
[ 'uselang' => 'content', 'errorformat' => 'plaintext' ],
[
- 'uselang' => $wgContLang->getCode(),
+ 'uselang' => 'en',
'class' => ApiErrorFormatter::class,
- 'lang' => $wgContLang->getCode(),
+ 'lang' => 'en',
'format' => 'plaintext',
'usedb' => false,
]
[
'uselang' => 'ru',
'class' => ApiErrorFormatter::class,
- 'lang' => $wgContLang->getCode(),
+ 'lang' => 'en',
'format' => 'plaintext',
'usedb' => false,
]
$context->setRequest( new FauxRequest( [ 'errorformat' => 'plaintext' ] ) );
$context->setLanguage( 'en' );
$context->setConfig( new MultiConfig( [
- new HashConfig( [ 'ShowHostnames' => true, 'ShowSQLErrors' => false ] ),
+ new HashConfig( [
+ 'ShowHostnames' => true, 'ShowSQLErrors' => false,
+ 'ShowExceptionDetails' => true, 'ShowDBErrorBacktrace' => true,
+ ] ),
$context->getConfig()
] ) );
);
}
- // Not static so $this->getMock() can be used
+ // Not static so $this can be used
public function provideExceptionErrors() {
$reqId = WebRequest::getRequestId();
$doclink = wfExpandUrl( wfScript( 'api' ) );
MWExceptionHandler::getRedactedTraceAsString( $ex )
)->inLanguage( 'en' )->useDatabase( false )->text();
- $dbex = new DBQueryError( $this->getMock( 'IDatabase' ), 'error', 1234, 'SELECT 1', __METHOD__ );
+ $dbex = new DBQueryError(
+ $this->createMock( 'IDatabase' ),
+ 'error', 1234, 'SELECT 1', __METHOD__ );
$dbtrace = wfMessage( 'api-exception-trace',
get_class( $dbex ),
$dbex->getFile(),