6 class TidyTest
extends MediaWikiTestCase
{
8 protected function setUp() {
10 $check = MWTidy
::tidy( '' );
11 if ( strpos( $check, '<!--' ) !== false ) {
12 $this->markTestSkipped( 'Tidy not found' );
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 function provideTestWrapping() {
31 '<mw:editsection page="foo" section="bar">foo</mw:editsection>',
32 '<mw:editsection page="foo" section="bar">foo</mw:editsection>',
33 '<mw:editsection> should survive tidy'
36 '<editsection page="foo" section="bar">foo</editsection>',
37 '<editsection page="foo" section="bar">foo</editsection>',
38 '<editsection> should survive tidy'
40 array( '<mw:toc>foo</mw:toc>', '<mw:toc>foo</mw:toc>', '<mw:toc> should survive tidy' ),
41 array( "<link foo=\"bar\" />\nfoo", '<link foo="bar"/>foo', '<link> should survive tidy' ),
42 array( "<meta foo=\"bar\" />\nfoo", '<meta foo="bar"/>foo', '<meta> should survive tidy' ),