WikiPage::preSaveTransform() was deprecated in r103228 (018d885f)
authorPlatonides <platonides@gmail.com>
Sat, 23 Jun 2012 18:28:51 +0000 (20:28 +0200)
committerPlatonides <platonides@gmail.com>
Sat, 23 Jun 2012 18:28:51 +0000 (20:28 +0200)
Hide the warning on the tests and add tests for the Parser method.

Change-Id: I939bf59206da1dd45e33db2251e92d9792a0a767

tests/phpunit/includes/WikiPageTest.php
tests/phpunit/includes/parser/ParserMethodsTest.php [new file with mode: 0644]

index c8606cc..b72a5cd 100644 (file)
@@ -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 (file)
index 0000000..10b57eb
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+
+class ParserLesserFunctionsTest extends MediaWikiLangTestCase {
+
+       public function dataPreSaveTransform() {
+               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 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()
+}
+