wiki.techinc.nl/tests/phpunit/includes/parser/ParserMethodsTest.php
Siebrand Mazeland 49dfbc59d0 Update formatting
6 of n.

Change-Id: I0ca3f1f72349623631ce1d7f3a4e2ed5edbdbdf4
2013-02-15 12:44:42 +00:00

32 lines
889 B
PHP

<?php
class ParserMethodsTest extends MediaWikiLangTestCase {
public static function providePreSaveTransform() {
return array(
array( 'hello this is ~~~',
"hello this is [[Special:Contributions/127.0.0.1|127.0.0.1]]",
),
array( 'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
),
);
}
/**
* @dataProvider providePreSaveTransform
*/
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()
}