mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-24 23:46:39 +00:00
bc52c77d24
* Use string constants instead of integers * Derive new names from old via conversion of constant naming convention to CamelCase. * Replace old constant string e.g. 'MW_MATH_ABC_DEF' with new string 'abcDef' * Replace old constant value with new string. * Tests to demonstrates what is actually done. * Rename constants Bug: T106630 Bug: T106631 Bug: T87941 Change-Id: I6d1094ece79e912d9ddbef6681a25196c7a6e801
34 lines
799 B
PHP
34 lines
799 B
PHP
<?php
|
|
/**
|
|
* Test the TeX source output format.
|
|
* @group Math
|
|
*/
|
|
class MathSourceTest extends MediaWikiTestCase {
|
|
|
|
/**
|
|
* Checks the basic functionallity
|
|
* i.e. if the span element is generated right.
|
|
*/
|
|
public function testBasics() {
|
|
$real = MathRenderer::renderMath( "a+b", array(), 'source' );
|
|
$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() {
|
|
$real = MathRenderer::renderMath( "a\n b", array(), 'source' );
|
|
$this->assertSame(
|
|
'<span class="mwe-math-fallback-source-inline tex" dir="ltr">$ a b $</span>',
|
|
$real,
|
|
"converting newlines to spaces"
|
|
);
|
|
}
|
|
|
|
}
|