mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-12-11 15:36:28 +00:00
480d241f97
The MathEntitySelector gets its config from wbRepo which caused a hard dependency on the Wikibase client. If the Wikibase client config is not available a default value (wikidata) is used to determine the URL of the foreign repo. As the dropdown will never do write operations, we restrict the repo access to anonymous read only. Bug: T313143 Change-Id: Iba33dfd32a78f4ad7c2e99a1f56218458ab884b4
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
namespace MediaWiki\Extension\Math\Tests;
|
|
|
|
use ExtensionRegistry;
|
|
use HashConfig;
|
|
use MediaWiki\Config\ServiceOptions;
|
|
use MediaWiki\Extension\Math\Math;
|
|
use MediaWiki\Extension\Math\MathConfig;
|
|
use MediaWiki\MediaWikiServices;
|
|
use MediaWikiUnitTestCase;
|
|
|
|
/**
|
|
* @covers \MediaWiki\Extension\Math\Math
|
|
*/
|
|
class MathTest extends MediaWikiUnitTestCase {
|
|
private const DUMMY_URL = 'https://example.com/api.php';
|
|
|
|
public function testGetMathConfigService() {
|
|
$config = new HashConfig( [
|
|
'MathDisableTexFilter' => MathConfig::NEW,
|
|
'MathValidModes' => [ MathConfig::MODE_SOURCE ],
|
|
'MathEntitySelectorFallbackUrl' => self::DUMMY_URL,
|
|
] );
|
|
$services = new MediaWikiServices( $config );
|
|
$services->defineService( 'Math.Config',
|
|
static function ( MediaWikiServices $services ){
|
|
return new MathConfig(
|
|
new ServiceOptions(
|
|
MathConfig::CONSTRUCTOR_OPTIONS,
|
|
$services->get( 'BootstrapConfig' ) ),
|
|
ExtensionRegistry::getInstance()
|
|
);
|
|
}
|
|
);
|
|
$mathConfig = Math::getMathConfig( $services );
|
|
$this->assertStringContainsString( 'new', $mathConfig->texCheckDisabled() );
|
|
}
|
|
}
|