2014-10-09 13:49:26 +00:00
|
|
|
<?php
|
2016-02-12 16:57:37 +00:00
|
|
|
|
2014-10-09 13:49:26 +00:00
|
|
|
/**
|
2016-02-12 16:57:37 +00:00
|
|
|
* Test the LaTeXML output format.
|
|
|
|
*
|
2019-11-26 09:59:54 +00:00
|
|
|
* @covers \MathLaTeXML
|
2016-02-12 16:57:37 +00:00
|
|
|
*
|
|
|
|
* @group Math
|
|
|
|
*
|
2018-04-13 14:06:39 +00:00
|
|
|
* @license GPL-2.0-or-later
|
2016-02-12 16:57:37 +00:00
|
|
|
*/
|
2014-10-09 13:49:26 +00:00
|
|
|
class MathLaTeXMLTest extends MediaWikiTestCase {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests the serialization of the LaTeXML settings
|
2019-11-26 09:59:54 +00:00
|
|
|
* @covers \MathLaTeXML::serializeSettings
|
2014-10-09 13:49:26 +00:00
|
|
|
*/
|
|
|
|
public function testSerializeSettings() {
|
2019-11-26 10:21:13 +00:00
|
|
|
$renderer = new MathLaTeXML();
|
2016-04-12 20:53:25 +00:00
|
|
|
$sampleSettings = [
|
2014-10-09 13:49:26 +00:00
|
|
|
'k1' => 'v1',
|
|
|
|
'k2&=' => 'v2 + & *üö',
|
2016-04-12 20:53:25 +00:00
|
|
|
'k3' => [
|
2014-10-09 13:49:26 +00:00
|
|
|
'v3A', 'v3b'
|
2016-04-12 20:53:25 +00:00
|
|
|
]
|
|
|
|
];
|
2014-10-09 13:49:26 +00:00
|
|
|
$expected = 'k1=v1&k2%26%3D=v2+%2B+%26+%2A%C3%BC%C3%B6&k3=v3A&k3=v3b';
|
|
|
|
$this->assertEquals(
|
|
|
|
$expected,
|
|
|
|
$renderer->serializeSettings( $sampleSettings ),
|
|
|
|
'test serialization of array settings'
|
|
|
|
);
|
|
|
|
$this->assertEquals(
|
|
|
|
$expected,
|
|
|
|
$renderer->serializeSettings( $expected ),
|
|
|
|
'test serialization of a string setting'
|
|
|
|
);
|
|
|
|
}
|
2015-01-10 01:55:54 +00:00
|
|
|
}
|