2014-10-09 13:49:26 +00:00
|
|
|
<?php
|
2016-02-12 16:57:37 +00:00
|
|
|
|
2021-04-07 22:22:05 +00:00
|
|
|
use MediaWiki\Extension\Math\MathLaTeXML;
|
|
|
|
|
2014-10-09 13:49:26 +00:00
|
|
|
/**
|
2016-02-12 16:57:37 +00:00
|
|
|
* Test the LaTeXML output format.
|
|
|
|
*
|
2021-04-07 22:22:05 +00:00
|
|
|
* @covers \MediaWiki\Extension\Math\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
|
2021-04-07 22:22:05 +00:00
|
|
|
* @covers \MediaWiki\Extension\Math\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
|
|
|
}
|