X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fapi%2FApiMainTest.php;h=3e6ceb7a6e4cd23b4512ab5b3aaa7b56b5f58d2f;hb=2ecb96a96fdd62b2521b6d9ac2d5e2dac0eba0ec;hp=eff41e34923ee8d07de89596aa582296c38268f7;hpb=ef96494e66ca6d36313dd08847c32aea93911c39;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/api/ApiMainTest.php b/tests/phpunit/includes/api/ApiMainTest.php index eff41e3492..3e6ceb7a6e 100644 --- a/tests/phpunit/includes/api/ApiMainTest.php +++ b/tests/phpunit/includes/api/ApiMainTest.php @@ -1,7 +1,10 @@ [ [], [ 'uselang' => 'ru', @@ -381,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, ] @@ -393,7 +394,7 @@ class ApiMainTest extends ApiTestCase { [ 'uselang' => 'ru', 'class' => ApiErrorFormatter::class, - 'lang' => $wgContLang->getCode(), + 'lang' => 'en', 'format' => 'plaintext', 'usedb' => false, ] @@ -451,7 +452,10 @@ class ApiMainTest extends ApiTestCase { $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() ] ) ); @@ -470,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' ) ); @@ -483,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(),