Merge "selenium: invoke jobs to enforce eventual consistency"
[lhc/web/wiklou.git] / tests / phpunit / includes / content / WikitextContentHandlerTest.php
index 59984d8..806038a 100644 (file)
@@ -1,5 +1,8 @@
 <?php
 
+use MediaWiki\MediaWikiServices;
+use MediaWiki\Revision\SlotRenderingProvider;
+
 /**
  * @group ContentHandler
  */
@@ -78,10 +81,9 @@ class WikitextContentHandlerTest extends MediaWikiLangTestCase {
         * @covers WikitextContentHandler::makeRedirectContent
         */
        public function testMakeRedirectContent( $title, $expected ) {
-               global $wgContLang;
-               $wgContLang->resetNamespaces();
+               MediaWikiServices::getInstance()->getContentLanguage()->resetNamespaces();
 
-               MagicWord::clearCache();
+               MediaWikiServices::getInstance()->resetServiceForTesting( 'MagicWordFactory' );
 
                if ( is_string( $title ) ) {
                        $title = Title::newFromText( $title );
@@ -362,4 +364,30 @@ class WikitextContentHandlerTest extends MediaWikiLangTestCase {
                $this->assertArrayHasKey( 'file_text', $data );
                $this->assertEquals( 'This is file content', $data['file_text'] );
        }
+
+       public function testGetSecondaryDataUpdates() {
+               $title = Title::newFromText( 'Somefile.jpg', NS_FILE );
+               $content = new WikitextContent( '' );
+
+               /** @var SlotRenderingProvider $srp */
+               $srp = $this->getMock( SlotRenderingProvider::class );
+
+               $handler = new WikitextContentHandler();
+               $updates = $handler->getSecondaryDataUpdates( $title, $content, 'main', $srp );
+
+               $this->assertEquals( [], $updates );
+       }
+
+       public function testGetDeletionUpdates() {
+               $title = Title::newFromText( 'Somefile.jpg', NS_FILE );
+               $content = new WikitextContent( '' );
+
+               $srp = $this->getMock( SlotRenderingProvider::class );
+
+               $handler = new WikitextContentHandler();
+               $updates = $handler->getDeletionUpdates( $title, 'main' );
+
+               $this->assertEquals( [], $updates );
+       }
+
 }