Merge "exception: Add newline at the end of a debugging line for CLI users"
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiMainTest.php
index 5c0a5d9..3e6ceb7 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use Wikimedia\TestingAccessWrapper;
+
 /**
  * @group API
  * @group Database
@@ -331,8 +333,6 @@ class ApiMainTest extends ApiTestCase {
        }
 
        public static function provideApiErrorFormatterCreation() {
-               global $wgContLang;
-
                return [
                        'Default (BC)' => [ [], [
                                'uselang' => 'ru',
@@ -382,9 +382,9 @@ class ApiMainTest extends ApiTestCase {
                        'uselang=content' => [
                                [ 'uselang' => 'content', 'errorformat' => 'plaintext' ],
                                [
-                                       'uselang' => $wgContLang->getCode(),
+                                       'uselang' => 'en',
                                        'class' => ApiErrorFormatter::class,
-                                       'lang' => $wgContLang->getCode(),
+                                       'lang' => 'en',
                                        'format' => 'plaintext',
                                        'usedb' => false,
                                ]
@@ -394,7 +394,7 @@ class ApiMainTest extends ApiTestCase {
                                [
                                        'uselang' => 'ru',
                                        'class' => ApiErrorFormatter::class,
-                                       'lang' => $wgContLang->getCode(),
+                                       'lang' => 'en',
                                        'format' => 'plaintext',
                                        'usedb' => false,
                                ]
@@ -474,7 +474,7 @@ class ApiMainTest extends ApiTestCase {
                );
        }
 
-       // 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' ) );
@@ -487,7 +487,9 @@ class ApiMainTest extends ApiTestCase {
                        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(),