Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4144051
MathSourceTest.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
MathSourceTest.php
View Options
<?php
use
MediaWiki\Extension\Math\MathConfig
;
use
MediaWiki\Extension\Math\MathSource
;
/**
* Test the TeX source output format.
*
* @covers \MediaWiki\Extension\Math\MathSource
*
* @license GPL-2.0-or-later
*/
class
MathSourceTest
extends
MediaWikiIntegrationTestCase
{
/**
* Checks the basic functionality
* i.e. if the span element is generated right.
*/
public
function
testBasics
()
{
$renderer
=
$this
->
getServiceContainer
()
->
get
(
'Math.RendererFactory'
)
->
getRenderer
(
'a+b'
,
[],
MathConfig
::
MODE_SOURCE
);
$renderer
->
render
();
$real
=
$renderer
->
getHtmlOutput
();
$this
->
assertEquals
(
'<span class="mwe-math-fallback-source-inline tex" dir="ltr">$ a+b $</span>'
,
$real
,
"Rendering of a+b in plain Text mode"
);
}
/**
* Checks if newlines are converted to spaces correctly.
*/
public
function
testNewLines
()
{
$renderer
=
$this
->
getServiceContainer
()
->
get
(
'Math.RendererFactory'
)
->
getRenderer
(
"a
\n
b"
,
[],
MathConfig
::
MODE_SOURCE
);
$renderer
->
render
();
$real
=
$renderer
->
getHtmlOutput
();
$this
->
assertSame
(
'<span class="mwe-math-fallback-source-inline tex" dir="ltr">$ a b $</span>'
,
$real
,
"converting newlines to spaces"
);
}
public
function
testConstructor
()
{
$renderer
=
new
MathSource
(
'a'
);
$this
->
assertEquals
(
MathConfig
::
MODE_SOURCE
,
$renderer
->
getMode
()
);
}
public
function
testRender
()
{
$renderer
=
new
MathSource
(
'a+b'
);
$this
->
assertTrue
(
$renderer
->
render
()
);
$this
->
assertFalse
(
$renderer
->
isChanged
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 19 2026, 17:04 (4 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b9/35/c7485f6b3fd3aaed03fe51f6bcc2
Default Alt Text
MathSourceTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment