Merge "DatabaseMssql: Don't duplicate body of makeList()"
[mediawiki.git] / tests / phpunit / includes / parser / TidyTest.php
blobf656a74dbf76906d4899d8ab662a4931df36b633
1 <?php
3 /**
4 * @group Parser
5 */
6 class TidyTest extends MediaWikiTestCase {
8 protected function setUp() {
9 parent::setUp();
10 $check = MWTidy::tidy( '' );
11 if ( strpos( $check, '<!--' ) !== false ) {
12 $this->markTestSkipped( 'Tidy not found' );
16 /**
17 * @dataProvider provideTestWrapping
19 public function testTidyWrapping( $expected, $text, $msg = '' ) {
20 $text = MWTidy::tidy( $text );
21 // We don't care about where Tidy wants to stick is <p>s
22 $text = trim( preg_replace( '#</?p>#', '', $text ) );
23 // Windows, we love you!
24 $text = str_replace( "\r", '', $text );
25 $this->assertEquals( $expected, $text, $msg );
28 public static function provideTestWrapping() {
29 $testMathML = <<<'MathML'
30 <math xmlns="http://www.w3.org/1998/Math/MathML">
31 <mrow>
32 <mi>a</mi>
33 <mo>&InvisibleTimes;</mo>
34 <msup>
35 <mi>x</mi>
36 <mn>2</mn>
37 </msup>
38 <mo>+</mo>
39 <mi>b</mi>
40 <mo>&InvisibleTimes; </mo>
41 <mi>x</mi>
42 <mo>+</mo>
43 <mi>c</mi>
44 </mrow>
45 </math>
46 MathML;
47 return array(
48 array(
49 '<mw:editsection page="foo" section="bar">foo</mw:editsection>',
50 '<mw:editsection page="foo" section="bar">foo</mw:editsection>',
51 '<mw:editsection> should survive tidy'
53 array(
54 '<editsection page="foo" section="bar">foo</editsection>',
55 '<editsection page="foo" section="bar">foo</editsection>',
56 '<editsection> should survive tidy'
58 array( '<mw:toc>foo</mw:toc>', '<mw:toc>foo</mw:toc>', '<mw:toc> should survive tidy' ),
59 array( "<link foo=\"bar\" />\nfoo", '<link foo="bar"/>foo', '<link> should survive tidy' ),
60 array( "<meta foo=\"bar\" />\nfoo", '<meta foo="bar"/>foo', '<meta> should survive tidy' ),
61 array( $testMathML, $testMathML, '<math> should survive tidy' ),