Merge "Add part to update ctd_user_defined in populateChangeTagDef"
[lhc/web/wiklou.git] / tests / phpunit / includes / content / WikitextContentTest.php
index c78bc5b..be93563 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * @group ContentHandler
  *
@@ -303,7 +305,7 @@ just a test"
         * @covers WikitextContent::matchMagicWord
         */
        public function testMatchMagicWord() {
-               $mw = MagicWord::get( "staticredirect" );
+               $mw = MediaWikiServices::getInstance()->getMagicWordFactory()->get( "staticredirect" );
 
                $content = $this->newContent( "#REDIRECT [[FOO]]\n__STATICREDIRECT__" );
                $this->assertTrue( $content->matchMagicWord( $mw ), "should have matched magic word" );
@@ -429,15 +431,30 @@ just a test"
 
        public static function dataGetDeletionUpdates() {
                return [
-                       [ "WikitextContentTest_testGetSecondaryDataUpdates_1",
+                       [
                                CONTENT_MODEL_WIKITEXT, "hello ''world''\n",
                                [ LinksDeletionUpdate::class => [] ]
                        ],
-                       [ "WikitextContentTest_testGetSecondaryDataUpdates_2",
+                       [
                                CONTENT_MODEL_WIKITEXT, "hello [[world test 21344]]\n",
                                [ LinksDeletionUpdate::class => [] ]
                        ],
                        // @todo more...?
                ];
        }
+
+       /**
+        * @covers WikitextContent::preSaveTransform
+        * @covers WikitextContent::fillParserOutput
+        */
+       public function testHadSignature() {
+               $titleObj = Title::newFromText( __CLASS__ );
+
+               $content = new WikitextContent( '~~~~' );
+               $pstContent = $content->preSaveTransform(
+                       $titleObj, $this->getTestUser()->getUser(), new ParserOptions()
+               );
+
+               $this->assertTrue( $pstContent->getParserOutput( $titleObj )->getFlag( 'user-signature' ) );
+       }
 }