From a05c1a1ab7e963334ba609147f83555ce61eaa1e Mon Sep 17 00:00:00 2001 From: Platonides Date: Sat, 23 Jun 2012 20:28:51 +0200 Subject: [PATCH] WikiPage::preSaveTransform() was deprecated in r103228 (018d885f) Hide the warning on the tests and add tests for the Parser method. Change-Id: I939bf59206da1dd45e33db2251e92d9792a0a767 --- tests/phpunit/includes/WikiPageTest.php | 1 + .../includes/parser/ParserMethodsTest.php | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tests/phpunit/includes/parser/ParserMethodsTest.php diff --git a/tests/phpunit/includes/WikiPageTest.php b/tests/phpunit/includes/WikiPageTest.php index c8606cc745..b72a5cd825 100644 --- a/tests/phpunit/includes/WikiPageTest.php +++ b/tests/phpunit/includes/WikiPageTest.php @@ -769,6 +769,7 @@ more stuff * @dataProvider dataPreSaveTransform */ public function testPreSaveTransform( $text, $expected ) { + $this->hideDeprecated( 'WikiPage::preSaveTransform' ); $user = new User(); $user->setName("127.0.0.1"); diff --git a/tests/phpunit/includes/parser/ParserMethodsTest.php b/tests/phpunit/includes/parser/ParserMethodsTest.php new file mode 100644 index 0000000000..10b57ebb01 --- /dev/null +++ b/tests/phpunit/includes/parser/ParserMethodsTest.php @@ -0,0 +1,33 @@ +~~~', + 'hello \'\'this\'\' is ~~~', + ), + ); + } + + /** + * @dataProvider dataPreSaveTransform + */ + 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() +} + -- 2.20.1