| 1 |
<?php |
| 2 |
|
| 3 |
use MediaWiki\Extension\Math\MathLaTeXML; |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
class MathLaTeXMLTest extends MediaWikiIntegrationTestCase { |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
public function testSerializeSettings() { |
| 21 |
$renderer = new MathLaTeXML(); |
| 22 |
$sampleSettings = [ |
| 23 |
'k1' => 'v1', |
| 24 |
'k2&=' => 'v2 + & *üö', |
| 25 |
'k3' => [ |
| 26 |
'v3A', 'v3b' |
| 27 |
] |
| 28 |
]; |
| 29 |
$expected = 'k1=v1&k2%26%3D=v2+%2B+%26+%2A%C3%BC%C3%B6&k3=v3A&k3=v3b'; |
| 30 |
$this->assertEquals( |
| 31 |
$expected, |
| 32 |
$renderer->serializeSettings( $sampleSettings ), |
| 33 |
'test serialization of array settings' |
| 34 |
); |
| 35 |
$this->assertEquals( |
| 36 |
$expected, |
| 37 |
$renderer->serializeSettings( $expected ), |
| 38 |
'test serialization of a string setting' |
| 39 |
); |
| 40 |
} |
| 41 |
} |