diff options
author | Derick Alangi <alangiderick@gmail.com> | 2022-07-06 16:05:30 +0100 |
---|---|---|
committer | Umherirrender <umherirrender_de.wp@web.de> | 2022-07-12 22:24:50 +0000 |
commit | a3a2ed268a39f6e6b257b7d682f921a46b6b6634 (patch) | |
tree | 790c409660dad73a5a2428f8ddbe40bdbf22420d /tests/phpunit/includes/api/ApiMainTest.php | |
parent | 34bb7c33561f308931eb7883efebc82fdfaa85d4 (diff) | |
download | mediawikicore-a3a2ed268a39f6e6b257b7d682f921a46b6b6634.tar.gz mediawikicore-a3a2ed268a39f6e6b257b7d682f921a46b6b6634.zip |
tests: Use `overrideConfig(Value|Values)` where needed
This patch covers: tests/phpunit/includes/actions/ and
tests/phpunit/includes/api/.
Change-Id: I60d8fb7b8a63b423606db935fa0d24cf859b2512
Diffstat (limited to 'tests/phpunit/includes/api/ApiMainTest.php')
-rw-r--r-- | tests/phpunit/includes/api/ApiMainTest.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/phpunit/includes/api/ApiMainTest.php b/tests/phpunit/includes/api/ApiMainTest.php index 534f118cf7f6..e967464c583f 100644 --- a/tests/phpunit/includes/api/ApiMainTest.php +++ b/tests/phpunit/includes/api/ApiMainTest.php @@ -1,5 +1,6 @@ <?php +use MediaWiki\MainConfigNames; use MediaWiki\Permissions\Authority; use MediaWiki\Tests\Unit\Permissions\MockAuthorityTrait; use Wikimedia\Rdbms\DBConnRef; @@ -313,7 +314,7 @@ class ApiMainTest extends ApiTestCase { // it does fail. $now = time(); - $this->setMwGlobals( 'wgCacheEpoch', '20030516000000' ); + $this->overrideConfigValue( MainConfigNames::CacheEpoch, '20030516000000' ); $mock = $this->createMock( ApiBase::class ); $mock->method( 'getModuleName' )->willReturn( 'testmodule' ); @@ -378,7 +379,7 @@ class ApiMainTest extends ApiTestCase { $this->expectException( ApiUsageException::class ); $this->expectExceptionMessage( 'Waiting for a database server: 4 seconds lagged.' ); - $this->setMwGlobals( 'wgShowHostnames', false ); + $this->overrideConfigValue( MainConfigNames::ShowHostnames, false ); $this->doTestCheckMaxLag( 4 ); } @@ -387,7 +388,7 @@ class ApiMainTest extends ApiTestCase { $this->expectException( ApiUsageException::class ); $this->expectExceptionMessage( 'Waiting for somehost: 4 seconds lagged.' ); - $this->setMwGlobals( 'wgShowHostnames', true ); + $this->overrideConfigValue( MainConfigNames::ShowHostnames, true ); $this->doTestCheckMaxLag( 4 ); } @@ -516,11 +517,11 @@ class ApiMainTest extends ApiTestCase { $priv->mInternalMode = false; if ( !empty( $options['cdn'] ) ) { - $this->setMwGlobals( 'wgUseCdn', true ); + $this->overrideConfigValue( MainConfigNames::UseCdn, true ); } // Can't do this in TestSetup.php because Setup.php will override it - $this->setMwGlobals( 'wgCacheEpoch', '20030516000000' ); + $this->overrideConfigValue( MainConfigNames::CacheEpoch, '20030516000000' ); $module = $this->getMockBuilder( ApiBase::class ) ->setConstructorArgs( [ $api, 'mock' ] ) |