mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-27 17:01:07 +00:00
c869831f45
This change adds test cases for the MathSource class and registers a hook for loading these tests. Also adds documentation about how to run these tests in README. Change-Id: Ie58a273326e0353dfa4437b3de21a2393adb5a87
27 lines
714 B
PHP
27 lines
714 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 simpleTest(){
|
|
$real=MathRenderer::renderMath("a+b",array(),MW_MATH_SOURCE);
|
|
$this->assertEquals('<span class="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(),MW_MATH_SOURCE);
|
|
$this->assertSame('<span class="tex" dir="ltr">$ a b $</span>', $real
|
|
, "converting newlines to spaces");
|
|
}
|
|
|
|
} |