mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-09-23 10:21:31 +00:00
Use overrideConfigValue instead of setMwGlobals
Change-Id: Id53db757cf0c2f0601cc34a9403edf3bbb1f7298
This commit is contained in:
parent
3ee9495853
commit
363abd4afb
|
@ -20,7 +20,7 @@ class MathMathMLTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->setMwGlobals( 'wgMathoidCli', false );
|
||||
$this->overrideConfigValue( 'MathoidCli', false );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,9 +56,7 @@ class MathMathMLTest extends MediaWikiIntegrationTestCase {
|
|||
*/
|
||||
public function testMakeRequestInvalid() {
|
||||
$url = 'http://example.com/invalid';
|
||||
$this->setMwGlobals( [
|
||||
'wgMathMathMLUrl' => $url,
|
||||
] );
|
||||
$this->overrideConfigValue( 'MathMathMLUrl', $url );
|
||||
$this->installMockHttp(
|
||||
$this->makeFakeHttpRequest( 'Method Not Allowed', 405 )
|
||||
);
|
||||
|
@ -95,9 +93,7 @@ class MathMathMLTest extends MediaWikiIntegrationTestCase {
|
|||
*/
|
||||
public function testMakeRequestTimeout() {
|
||||
$url = 'http://example.com/timeout';
|
||||
$this->setMwGlobals( [
|
||||
'wgMathMathMLUrl' => $url,
|
||||
] );
|
||||
$this->overrideConfigValue( 'MathMathMLUrl', $url );
|
||||
$this->installMockHttp(
|
||||
$this->makeFakeTimeoutRequest()
|
||||
);
|
||||
|
@ -169,7 +165,7 @@ class MathMathMLTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
public function testWarning() {
|
||||
$this->setupGoodMathRestBaseMockHttp();
|
||||
$this->setMwGlobals( "wgMathDisableTexFilter", 'always' );
|
||||
$this->overrideConfigValue( 'MathDisableTexFilter', 'always' );
|
||||
|
||||
$renderer = new MathMathML();
|
||||
$rbi = $this->getMockBuilder( MathRestbaseInterface::class )
|
||||
|
|
|
@ -22,7 +22,7 @@ class MathNativeMMLTest extends MediaWikiIntegrationTestCase {
|
|||
$lbFactory = $this->createMock( LBFactory::class );
|
||||
$lbFactory->method( 'getReplicaDatabase' )->willReturn( $db );
|
||||
$this->setService( 'DBLoadBalancerFactory', $lbFactory );
|
||||
$this->setMwGlobals( 'wgMathValidModes', [ 'native' ] );
|
||||
$this->overrideConfigValue( 'MathValidModes', [ 'native' ] );
|
||||
$this->clearHooks();
|
||||
}
|
||||
|
||||
|
@ -35,14 +35,14 @@ class MathNativeMMLTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
public function testNoLink() {
|
||||
$this->setMwGlobals( 'wgMathEnableFormulaLinks', false );
|
||||
$this->overrideConfigValue( 'MathEnableFormulaLinks', false );
|
||||
$mml = new MathNativeMML( '\sin', [ 'qid' => 'Q1' ] );
|
||||
$this->assertTrue( $mml->render() );
|
||||
$this->assertStringNotContainsString( 'href', $mml->getMathml() );
|
||||
}
|
||||
|
||||
public function testLink() {
|
||||
$this->setMwGlobals( 'wgMathEnableFormulaLinks', true );
|
||||
$this->overrideConfigValue( 'MathEnableFormulaLinks', true );
|
||||
$mml = new MathNativeMML( '\sin', [ 'qid' => 'Q1' ] );
|
||||
$this->assertTrue( $mml->render() );
|
||||
$this->assertStringContainsString( 'href', $mml->getMathml() );
|
||||
|
|
|
@ -81,7 +81,7 @@ class MathRendererTest extends MediaWikiIntegrationTestCase {
|
|||
public function testDisableCheckingAlways() {
|
||||
$this->setupGoodMathRestBaseMockHttp();
|
||||
|
||||
$this->setMwGlobals( "wgMathDisableTexFilter", 'never' );
|
||||
$this->overrideConfigValue( 'MathDisableTexFilter', 'never' );
|
||||
$renderer =
|
||||
$this->getMockBuilder( MathRenderer::class )->onlyMethods( [
|
||||
'render',
|
||||
|
@ -100,7 +100,7 @@ class MathRendererTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
public function testDisableCheckingNever() {
|
||||
$this->setMwGlobals( "wgMathDisableTexFilter", 'always' );
|
||||
$this->overrideConfigValue( 'MathDisableTexFilter', 'always' );
|
||||
$renderer =
|
||||
$this->getMockBuilder( MathRenderer::class )->onlyMethods( [
|
||||
'render',
|
||||
|
@ -119,7 +119,7 @@ class MathRendererTest extends MediaWikiIntegrationTestCase {
|
|||
public function testCheckingNewUnknown() {
|
||||
$this->setupGoodMathRestBaseMockHttp();
|
||||
|
||||
$this->setMwGlobals( "wgMathDisableTexFilter", 'new' );
|
||||
$this->overrideConfigValue( 'MathDisableTexFilter', 'new' );
|
||||
$renderer =
|
||||
$this->getMockBuilder( MathRenderer::class )->onlyMethods( [
|
||||
'render',
|
||||
|
@ -141,7 +141,7 @@ class MathRendererTest extends MediaWikiIntegrationTestCase {
|
|||
public function testCheckingNewKnown() {
|
||||
$this->setupGoodMathRestBaseMockHttp();
|
||||
|
||||
$this->setMwGlobals( "wgMathDisableTexFilter", 'new' );
|
||||
$this->overrideConfigValue( 'MathDisableTexFilter', 'new' );
|
||||
$renderer =
|
||||
$this->getMockBuilder( MathRenderer::class )->onlyMethods( [
|
||||
'render',
|
||||
|
|
|
@ -19,7 +19,7 @@ use Psr\Log\NullLogger;
|
|||
class ParserIntegrationTests extends MediaWikiIntegrationTestCase {
|
||||
|
||||
private function setupDummyRendering() {
|
||||
$this->setMwGlobals( 'wgMathValidModes', [ MathConfig::MODE_SOURCE, MathConfig::MODE_LATEXML ] );
|
||||
$this->overrideConfigValue( 'MathValidModes', [ MathConfig::MODE_SOURCE, MathConfig::MODE_LATEXML ] );
|
||||
$this->mergeMwGlobalArrayValue( 'wgDefaultUserOptions', [ 'math' => MathConfig::MODE_SOURCE ] );
|
||||
$this->setService( 'Math.RendererFactory', new class(
|
||||
new ServiceOptions( RendererFactory::CONSTRUCTOR_OPTIONS, [
|
||||
|
|
Loading…
Reference in a new issue