Merge "Fix sessionfailure i18n message during authentication"
[lhc/web/wiklou.git] / tests / phpunit / includes / content / ContentHandlerTest.php
index 1bd2eb0..309b7b1 100644 (file)
@@ -22,12 +22,12 @@ class ContentHandlerTest extends MediaWikiTestCase {
                                12312 => 'testing',
                        ],
                        'wgContentHandlers' => [
-                               CONTENT_MODEL_WIKITEXT => 'WikitextContentHandler',
-                               CONTENT_MODEL_JAVASCRIPT => 'JavaScriptContentHandler',
-                               CONTENT_MODEL_JSON => 'JsonContentHandler',
-                               CONTENT_MODEL_CSS => 'CssContentHandler',
-                               CONTENT_MODEL_TEXT => 'TextContentHandler',
-                               'testing' => 'DummyContentHandlerForTesting',
+                               CONTENT_MODEL_WIKITEXT => WikitextContentHandler::class,
+                               CONTENT_MODEL_JAVASCRIPT => JavaScriptContentHandler::class,
+                               CONTENT_MODEL_JSON => JsonContentHandler::class,
+                               CONTENT_MODEL_CSS => CssContentHandler::class,
+                               CONTENT_MODEL_TEXT => TextContentHandler::class,
+                               'testing' => DummyContentHandlerForTesting::class,
                                'testing-callbacks' => function ( $modelId ) {
                                        return new DummyContentHandlerForTesting( $modelId );
                                }
@@ -248,10 +248,6 @@ class ContentHandlerTest extends MediaWikiTestCase {
                $this->assertNull( $text );
        }
 
-       /*
-       public static function makeContent( $text, Title $title, $modelId = null, $format = null ) {}
-       */
-
        public static function dataMakeContent() {
                return [
                        [ 'hallo', 'Help:Test', null, null, CONTENT_MODEL_WIKITEXT, 'hallo', false ],
@@ -332,7 +328,9 @@ class ContentHandlerTest extends MediaWikiTestCase {
                }
        }
 
-       /*
+       /**
+        * @covers ContentHandler::getAutosummary
+        *
         * Test if we become a "Created blank page" summary from getAutoSummary if no Content added to
         * page.
         */
@@ -368,17 +366,17 @@ class ContentHandlerTest extends MediaWikiTestCase {
                $this->assertSame( $tag, 'mw-contentmodelchange' );
        }
 
-       /*
-       public function testSupportsSections() {
-               $this->markTestIncomplete( "not yet implemented" );
-       }
-       */
-
+       /**
+        * @covers ContentHandler::supportsCategories
+        */
        public function testSupportsCategories() {
                $handler = new DummyContentHandlerForTesting( CONTENT_MODEL_WIKITEXT );
                $this->assertTrue( $handler->supportsCategories(), 'content model supports categories' );
        }
 
+       /**
+        * @covers ContentHandler::supportsDirectEditing
+        */
        public function testSupportsDirectEditing() {
                $handler = new DummyContentHandlerForTesting( CONTENT_MODEL_JSON );
                $this->assertFalse( $handler->supportsDirectEditing(), 'direct editing is not supported' );
@@ -396,17 +394,18 @@ class ContentHandlerTest extends MediaWikiTestCase {
 
        public function provideGetModelForID() {
                return [
-                       [ CONTENT_MODEL_WIKITEXT, 'WikitextContentHandler' ],
-                       [ CONTENT_MODEL_JAVASCRIPT, 'JavaScriptContentHandler' ],
-                       [ CONTENT_MODEL_JSON, 'JsonContentHandler' ],
-                       [ CONTENT_MODEL_CSS, 'CssContentHandler' ],
-                       [ CONTENT_MODEL_TEXT, 'TextContentHandler' ],
-                       [ 'testing', 'DummyContentHandlerForTesting' ],
-                       [ 'testing-callbacks', 'DummyContentHandlerForTesting' ],
+                       [ CONTENT_MODEL_WIKITEXT, WikitextContentHandler::class ],
+                       [ CONTENT_MODEL_JAVASCRIPT, JavaScriptContentHandler::class ],
+                       [ CONTENT_MODEL_JSON, JsonContentHandler::class ],
+                       [ CONTENT_MODEL_CSS, CssContentHandler::class ],
+                       [ CONTENT_MODEL_TEXT, TextContentHandler::class ],
+                       [ 'testing', DummyContentHandlerForTesting::class ],
+                       [ 'testing-callbacks', DummyContentHandlerForTesting::class ],
                ];
        }
 
        /**
+        * @covers ContentHandler::getForModelID
         * @dataProvider provideGetModelForID
         */
        public function testGetModelForID( $modelId, $handlerClass ) {
@@ -415,6 +414,9 @@ class ContentHandlerTest extends MediaWikiTestCase {
                $this->assertInstanceOf( $handlerClass, $handler );
        }
 
+       /**
+        * @covers ContentHandler::getFieldsForSearchIndex
+        */
        public function testGetFieldsForSearchIndex() {
                $searchEngine = $this->newSearchEngine();
 
@@ -430,7 +432,7 @@ class ContentHandlerTest extends MediaWikiTestCase {
        }
 
        private function newSearchEngine() {
-               $searchEngine = $this->getMockBuilder( 'SearchEngine' )
+               $searchEngine = $this->getMockBuilder( SearchEngine::class )
                        ->getMock();
 
                $searchEngine->expects( $this->any() )
@@ -446,7 +448,7 @@ class ContentHandlerTest extends MediaWikiTestCase {
         * @covers ContentHandler::getDataForSearchIndex
         */
        public function testDataIndexFields() {
-               $mockEngine = $this->createMock( 'SearchEngine' );
+               $mockEngine = $this->createMock( SearchEngine::class );
                $title = Title::newFromText( 'Not_Main_Page', NS_MAIN );
                $page = new WikiPage( $title );