From f2dff6574b0809e2a1dc0aa053b8c86bbe2b9b0c Mon Sep 17 00:00:00 2001 From: physikerwelt Date: Tue, 22 Jul 2014 18:42:48 -0400 Subject: [PATCH] Fix: id-attribute Id attribute was read wrong place Change-Id: I6f2671a322f637a1d8e0c88833ce4456d188829b --- MathRenderer.php | 8 ++++---- tests/MathIdTest.php | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 tests/MathIdTest.php diff --git a/MathRenderer.php b/MathRenderer.php index 58a317a61..8e465834d 100644 --- a/MathRenderer.php +++ b/MathRenderer.php @@ -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']; } diff --git a/tests/MathIdTest.php b/tests/MathIdTest.php new file mode 100644 index 000000000..c7c571964 --- /dev/null +++ b/tests/MathIdTest.php @@ -0,0 +1,17 @@ + RANDOM_ID ) ); + $this->assertEquals( RANDOM_ID, $renderer->getId() ); + } + +} \ No newline at end of file