mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-23 23:25:02 +00:00
Move debug integration test to special-page
Since all other LaTexML integration tests will be performed from the math status special page, it seems reasonable to run the debug tests from this specialpage as well. Change-Id: I47c405dbe16c2585907b9f67cdc01ed76e51892a
This commit is contained in:
parent
f10eb055d6
commit
f756414e21
|
@ -51,8 +51,18 @@ class SpecialMathStatus extends SpecialPage {
|
|||
}
|
||||
|
||||
private function runMathLaTeXMLTest( $modeName ) {
|
||||
global $wgMathDebug;
|
||||
$this->getOutput()->addWikiMsgArray( 'math-test-start', $modeName );
|
||||
$this->testMathMLIntegration();
|
||||
if ( $wgMathDebug ){
|
||||
try {
|
||||
$this->testDebug();
|
||||
}catch ( Exception $e){
|
||||
$this->getOutput()->addWikiText(
|
||||
'Math debug test failed. Please run <code>mwscript update.php</code>');
|
||||
$this->getOutput()->addWikiText( $e->getMessage() );
|
||||
}
|
||||
}
|
||||
$this->getOutput()->addWikiMsgArray( 'math-test-end', $modeName );
|
||||
}
|
||||
|
||||
|
@ -120,6 +130,27 @@ class SpecialMathStatus extends SpecialPage {
|
|||
$renderer->getLastError() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the creation of the math table with debugging enabled.
|
||||
* @covers MathHooks::onLoadExtensionSchemaUpdates
|
||||
*/
|
||||
public function testDebug() {
|
||||
$dbr = wfGetDB( DB_SLAVE );
|
||||
if ( $dbr->getType() !== 'mysql' ) {
|
||||
$this->getOutput()->addWikiText( 'Debug columns not supported in ' . $dbr->getType() );
|
||||
return;
|
||||
}
|
||||
$renderer = MathRenderer::getRenderer( "a+b", array(), MW_MATH_MATHML );
|
||||
$this->assertTrue( $renderer->render( true ) , "MathDebug: Rendering a+b");
|
||||
$hash = $renderer->getInputHash();
|
||||
$row = $dbr->selectRow("mathlog", "*", array( "math_inputhash" => $hash ) , __METHOD__,
|
||||
array("order by" => "math_timestamp desc"));
|
||||
$this->assertContains( "success", $row->math_log ,"MathDebug: Search for 'success' in the log file" );
|
||||
$this->assertEquals( "type=inline-TeX&q=%7B%5Cdisplaystyle%20a%2Bb%7D", $row->math_post,
|
||||
"MathDebug: Check post variables in the log file" );
|
||||
$this->assertEquals( 5, $row->math_mode, "MathDebug: Check rendering mode");
|
||||
}
|
||||
|
||||
private function assertTrue( $expression, $message = '' ) {
|
||||
if ( $expression ){
|
||||
$this->getOutput()->addWikiMsgArray( 'math-test-success' , $message );
|
||||
|
|
Loading…
Reference in a new issue