Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4107335
MathNativeMMLTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
MathNativeMMLTest.php
View Options
<?php
use
MediaWiki\Extension\Math\MathNativeMML
;
use
Wikimedia\Rdbms\IDatabase
;
use
Wikimedia\Rdbms\LBFactory
;
/**
* Test the native MathML output format.
*
* @covers \MediaWiki\Extension\Math\MathNativeMML
*
* @group Math
*
* @license GPL-2.0-or-later
*/
class
MathNativeMMLTest
extends
MediaWikiIntegrationTestCase
{
protected
function
setUp
():
void
{
parent
::
setUp
();
$db
=
$this
->
createMock
(
IDatabase
::
class
);
$db
->
method
(
'selectRow'
)->
willReturn
(
false
);
$lbFactory
=
$this
->
createMock
(
LBFactory
::
class
);
$lbFactory
->
method
(
'getReplicaDatabase'
)->
willReturn
(
$db
);
$this
->
setService
(
'DBLoadBalancerFactory'
,
$lbFactory
);
$this
->
overrideConfigValue
(
'MathValidModes'
,
[
'native'
]
);
$this
->
clearHooks
();
}
public
function
testSin
()
{
$mml
=
new
MathNativeMML
(
'
\s
in'
);
$this
->
assertSame
(
'tex'
,
$mml
->
getInputType
()
);
$this
->
assertTrue
(
$mml
->
checkTeX
()
);
$this
->
assertTrue
(
$mml
->
render
()
);
$this
->
assertStringContainsString
(
'sin'
,
$mml
->
getMathml
()
);
}
public
function
testNoLink
()
{
$this
->
overrideConfigValue
(
'MathEnableFormulaLinks'
,
false
);
$mml
=
new
MathNativeMML
(
'
\s
in'
,
[
'qid'
=>
'Q1'
]
);
$this
->
assertTrue
(
$mml
->
render
()
);
$this
->
assertStringNotContainsString
(
'href'
,
$mml
->
getMathml
()
);
}
public
function
testLink
()
{
$this
->
overrideConfigValue
(
'MathEnableFormulaLinks'
,
true
);
$mml
=
new
MathNativeMML
(
'
\s
in'
,
[
'qid'
=>
'Q1'
]
);
$this
->
assertTrue
(
$mml
->
render
()
);
$this
->
assertStringContainsString
(
'href'
,
$mml
->
getMathml
()
);
}
public
function
testId
()
{
$mml
=
new
MathNativeMML
(
'
\s
in'
,
[
'id'
=>
'unique-id'
]
);
$this
->
assertTrue
(
$mml
->
render
()
);
$this
->
assertStringContainsString
(
'unique-id'
,
$mml
->
getMathml
()
);
}
public
function
testBlock
()
{
$mml
=
new
MathNativeMML
(
'
\s
in'
,
[
'display'
=>
'block'
]
);
$this
->
assertTrue
(
$mml
->
render
()
);
$this
->
assertStringContainsString
(
'block'
,
$mml
->
getMathml
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 20:00 (2 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
34/57/a891ce011233fe46b2cfac3b64b5
Default Alt Text
MathNativeMMLTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment