jenkins-bot has submitted this change and it was merged.

Change subject: Move debug integration test to special-page
......................................................................


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
---
M SpecialMathStatus.php
1 file changed, 31 insertions(+), 0 deletions(-)

Approvals:
  Physikerwelt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/SpecialMathStatus.php b/SpecialMathStatus.php
index c4c97b3..ec9a7be 100644
--- a/SpecialMathStatus.php
+++ b/SpecialMathStatus.php
@@ -51,8 +51,18 @@
        }
 
        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 @@
                          $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 );

-- 
To view, visit https://gerrit.wikimedia.org/r/189356
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I47c405dbe16c2585907b9f67cdc01ed76e51892a
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: debug
Gerrit-Owner: Physikerwelt <[email protected]>
Gerrit-Reviewer: Physikerwelt <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to