Fix: id-attribute

Id attribute was read wrong place

Change-Id: I6f2671a322f637a1d8e0c88833ce4456d188829b
This commit is contained in:
physikerwelt 2014-07-22 18:42:48 -04:00 committed by Physikerwelt
parent bc519c22f4
commit f2dff6574b
2 changed files with 21 additions and 4 deletions

View File

@ -76,6 +76,9 @@ abstract class MathRenderer {
$this->userInputTex = $tex;
$this->tex = $tex;
$this->params = $params;
if ( isset( $params['id'] ) ) {
$this->id = $params['id'];
}
}
/**
@ -139,10 +142,7 @@ abstract class MathRenderer {
$tex = '{\textstyle ' . $tex . '}';
}
}
$id = null;
if ( isset( $params['id'] ) ) {
$id = $params['id'];
}
if ( isset( $params['forcemathmode'] ) ) {
$mode = $params['forcemathmode'];
}

17
tests/MathIdTest.php Normal file
View File

@ -0,0 +1,17 @@
<?php
/**
* Test the Id feature
* @group Math
*/
class MathIdTest extends MediaWikiTestCase {
/**
* Checks if the id specified as attribute is set in the renderer object
*/
public function testBasics() {
define( 'RANDOM_ID', 'a_random_id' );
$renderer = MathRenderer::getRenderer( "a+b", array( 'id' => RANDOM_ID ) );
$this->assertEquals( RANDOM_ID, $renderer->getId() );
}
}