mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-12-04 20:18:35 +00:00
a5c334fdbc
The test doesn't need to depend on what extensions are available/installed. Also pass the test config more explicitly to ServiceOptions. Needed-by: I0a04c82250582fed7a66c1e10868d9b4f3823a28 Change-Id: Id2587fe7d31fcd652c26e5dd0a8cfcae3161efcc
40 lines
1.1 KiB
PHP
40 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',
|
|
function ( MediaWikiServices $services ) use ( $config ) {
|
|
return new MathConfig(
|
|
new ServiceOptions(
|
|
MathConfig::CONSTRUCTOR_OPTIONS,
|
|
$config
|
|
),
|
|
$this->createMock( ExtensionRegistry::class )
|
|
);
|
|
}
|
|
);
|
|
$mathConfig = Math::getMathConfig( $services );
|
|
$this->assertStringContainsString( 'new', $mathConfig->texCheckDisabled() );
|
|
}
|
|
}
|