2012-06-23 18:28:51 +00:00
|
|
|
<?php
|
|
|
|
|
|
2012-06-23 21:04:57 +00:00
|
|
|
class ParserMethodsTest extends MediaWikiLangTestCase {
|
2012-06-23 18:28:51 +00:00
|
|
|
|
2012-10-08 10:56:20 +00:00
|
|
|
public static function providePreSaveTransform() {
|
2012-06-23 18:28:51 +00:00
|
|
|
return array(
|
|
|
|
|
array( 'hello this is ~~~',
|
2013-02-15 10:24:31 +00:00
|
|
|
"hello this is [[Special:Contributions/127.0.0.1|127.0.0.1]]",
|
2012-06-23 18:28:51 +00:00
|
|
|
),
|
|
|
|
|
array( 'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
|
2013-02-15 10:24:31 +00:00
|
|
|
'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
|
2012-06-23 18:28:51 +00:00
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-10-08 10:56:20 +00:00
|
|
|
* @dataProvider providePreSaveTransform
|
2012-06-23 18:28:51 +00:00
|
|
|
*/
|
|
|
|
|
public function testPreSaveTransform( $text, $expected ) {
|
|
|
|
|
global $wgParser;
|
|
|
|
|
|
|
|
|
|
$title = Title::newFromText( str_replace( '::', '__', __METHOD__ ) );
|
|
|
|
|
$user = new User();
|
|
|
|
|
$user->setName( "127.0.0.1" );
|
|
|
|
|
$popts = ParserOptions::newFromUser( $user );
|
|
|
|
|
$text = $wgParser->preSaveTransform( $text, $title, $user, $popts );
|
|
|
|
|
|
|
|
|
|
$this->assertEquals( $expected, $text );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: Add tests for cleanSig() / cleanSigInSig(), getSection(), replaceSection(), getPreloadText()
|
|
|
|
|
}
|