mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-28 01:10:09 +00:00
Remove wgMathUseRestBase
Bug: T274436 Change-Id: I0c0311130516646833ef862e047c8f540f40c92a
This commit is contained in:
parent
6117a8eb6d
commit
d25dc0fb79
|
@ -111,9 +111,6 @@
|
|||
"MathoidCli": {
|
||||
"value": false
|
||||
},
|
||||
"MathUseRestBase": {
|
||||
"value": true
|
||||
},
|
||||
"MathValidModes": {
|
||||
"description": "To access this at run-time, use MathRenderer::getValidModes(). Do not use the non-normalized configuration directly.",
|
||||
"value": [
|
||||
|
|
|
@ -4,7 +4,6 @@ namespace MediaWiki\Extension\Math;
|
|||
|
||||
use DataValues\StringValue;
|
||||
use InvalidArgumentException;
|
||||
use MediaWiki\Extension\Math\InputCheck\RestbaseChecker;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use ValueValidators\Error;
|
||||
use ValueValidators\Result;
|
||||
|
@ -26,20 +25,16 @@ class MathValidator implements ValueValidator {
|
|||
* @throws InvalidArgumentException if not called with a StringValue
|
||||
*/
|
||||
public function validate( $value ) {
|
||||
global $wgMathUseRestBase;
|
||||
if ( !( $value instanceof StringValue ) ) {
|
||||
throw new InvalidArgumentException( '$value must be a StringValue' );
|
||||
}
|
||||
|
||||
// get input String from value
|
||||
$tex = $value->getValue();
|
||||
if ( $wgMathUseRestBase ) {
|
||||
$checker = new RestbaseChecker( $tex );
|
||||
} else {
|
||||
$checker = MediaWikiServices::getInstance()
|
||||
->getService( 'Math.CheckerFactory' )
|
||||
->newMathoidChecker( $tex, 'tex' );
|
||||
}
|
||||
|
||||
if ( $checker->isValid() ) {
|
||||
return Result::newSuccess();
|
||||
}
|
||||
|
|
|
@ -17,11 +17,6 @@ class MathValidatorTest extends MediaWikiTestCase {
|
|||
private const VADLID_TEX = "\sin x";
|
||||
private const INVADLID_TEX = "\\notExists";
|
||||
|
||||
protected function setUp() : void {
|
||||
parent::setUp();
|
||||
$this->setMwGlobals( 'wgMathUseRestBase', false );
|
||||
}
|
||||
|
||||
public function testNotStringValue() {
|
||||
$validator = new MathValidator();
|
||||
$this->expectException( InvalidArgumentException::class );
|
||||
|
|
Loading…
Reference in a new issue