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.
|
|
|
|
*
|
|
|
|
* @covers MathLaTeXML
|
|
|
|
*
|
|
|
|
* @group Math
|
|
|
|
*
|
|
|
|
* @licence GNU GPL v2+
|
|
|
|
*/
|
2014-10-09 13:49:26 +00:00
|
|
|
class MathLaTeXMLTest extends MediaWikiTestCase {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests the serialization of the LaTeXML settings
|
|
|
|
* @covers MathLaTeXML::serializeSettings
|
|
|
|
*/
|
|
|
|
public function testSerializeSettings() {
|
|
|
|
$renderer = $this->getMockBuilder( 'MathLaTeXML' )
|
2015-09-21 16:14:01 +00:00
|
|
|
->setMethods( null )
|
2014-10-09 13:49:26 +00:00
|
|
|
->disableOriginalConstructor()
|
|
|
|
->getMock();
|
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
|
|
|
}
|