MediaWiki  REL1_20
ParserMethodsTest.php
Go to the documentation of this file.
00001 <?php
00002 
00003 class ParserMethodsTest extends MediaWikiLangTestCase {
00004 
00005         public function dataPreSaveTransform() {
00006                 return array(
00007                         array( 'hello this is ~~~',
00008                                "hello this is [[Special:Contributions/127.0.0.1|127.0.0.1]]",
00009                         ),
00010                         array( 'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
00011                                'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
00012                         ),
00013                 );
00014         }
00015 
00019         public function testPreSaveTransform( $text, $expected ) {
00020                 global $wgParser;
00021 
00022                 $title = Title::newFromText( str_replace( '::', '__', __METHOD__ ) );
00023                 $user = new User();
00024                 $user->setName( "127.0.0.1" );
00025                 $popts = ParserOptions::newFromUser( $user );
00026                 $text = $wgParser->preSaveTransform( $text, $title, $user, $popts );
00027 
00028                 $this->assertEquals( $expected, $text );
00029         }
00030 
00031         // TODO: Add tests for cleanSig() / cleanSigInSig(), getSection(), replaceSection(), getPreloadText()
00032 }
00033