Merge "API: Warn when unsupported PHP array syntax is used"
[lhc/web/wiklou.git] / tests / phpunit / includes / content / TextContentTest.php
index c7138b7..253a035 100644 (file)
@@ -51,8 +51,11 @@ class TextContentTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider dataGetParserOutput
+        * @covers TextContent::getParserOutput
         */
-       public function testGetParserOutput( $title, $model, $text, $expectedHtml, $expectedFields = null ) {
+       public function testGetParserOutput( $title, $model, $text, $expectedHtml,
+               $expectedFields = null
+       ) {
                $title = Title::newFromText( $title );
                $content = ContentHandler::makeContent( $text, $title, $model );
 
@@ -96,6 +99,7 @@ class TextContentTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider dataPreSaveTransform
+        * @covers TextContent::preSaveTransform
         */
        public function testPreSaveTransform( $text, $expected ) {
                global $wgContLang;
@@ -103,7 +107,11 @@ class TextContentTest extends MediaWikiLangTestCase {
                $options = ParserOptions::newFromUserAndLang( $this->context->getUser(), $wgContLang );
 
                $content = $this->newContent( $text );
-               $content = $content->preSaveTransform( $this->context->getTitle(), $this->context->getUser(), $options );
+               $content = $content->preSaveTransform(
+                       $this->context->getTitle(),
+                       $this->context->getUser(),
+                       $options
+               );
 
                $this->assertEquals( $expected, $content->getNativeData() );
        }
@@ -119,6 +127,7 @@ class TextContentTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider dataPreloadTransform
+        * @covers TextContent::preloadTransform
         */
        public function testPreloadTransform( $text, $expected ) {
                global $wgContLang;
@@ -140,6 +149,7 @@ class TextContentTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider dataGetRedirectTarget
+        * @covers TextContent::getRedirectTarget
         */
        public function testGetRedirectTarget( $text, $expected ) {
                $content = $this->newContent( $text );
@@ -154,6 +164,7 @@ class TextContentTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider dataGetRedirectTarget
+        * @covers TextContent::isRedirect
         */
        public function testIsRedirect( $text, $expected ) {
                $content = $this->newContent( $text );
@@ -209,6 +220,7 @@ class TextContentTest extends MediaWikiLangTestCase {
        /**
         * @dataProvider dataIsCountable
         * @group Database
+        * @covers TextContent::isCountable
         */
        public function testIsCountable( $text, $hasLinks, $mode, $expected ) {
                $this->setMwGlobals( 'wgArticleCountMethod', $mode );
@@ -217,8 +229,13 @@ class TextContentTest extends MediaWikiLangTestCase {
 
                $v = $content->isCountable( $hasLinks, $this->context->getTitle() );
 
-               $this->assertEquals( $expected, $v, 'isCountable() returned unexpected value ' . var_export( $v, true )
-                       . ' instead of ' . var_export( $expected, true ) . " in mode `$mode` for text \"$text\"" );
+               $this->assertEquals(
+                       $expected,
+                       $v,
+                       'isCountable() returned unexpected value ' . var_export( $v, true )
+                               . ' instead of ' . var_export( $expected, true )
+                               . " in mode `$mode` for text \"$text\""
+               );
        }
 
        public static function dataGetTextForSummary() {
@@ -240,6 +257,7 @@ class TextContentTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider dataGetTextForSummary
+        * @covers TextContent::getTextForSummary
         */
        public function testGetTextForSummary( $text, $maxlength, $expected ) {
                $content = $this->newContent( $text );
@@ -247,12 +265,18 @@ class TextContentTest extends MediaWikiLangTestCase {
                $this->assertEquals( $expected, $content->getTextForSummary( $maxlength ) );
        }
 
+       /**
+        * @covers TextContent::getTextForSearchIndex
+        */
        public function testGetTextForSearchIndex() {
                $content = $this->newContent( 'hello world.' );
 
                $this->assertEquals( 'hello world.', $content->getTextForSearchIndex() );
        }
 
+       /**
+        * @covers TextContent::copy
+        */
        public function testCopy() {
                $content = $this->newContent( 'hello world.' );
                $copy = $content->copy();
@@ -261,30 +285,45 @@ class TextContentTest extends MediaWikiLangTestCase {
                $this->assertEquals( 'hello world.', $copy->getNativeData() );
        }
 
+       /**
+        * @covers TextContent::getSize
+        */
        public function testGetSize() {
                $content = $this->newContent( 'hello world.' );
 
                $this->assertEquals( 12, $content->getSize() );
        }
 
+       /**
+        * @covers TextContent::getNativeData
+        */
        public function testGetNativeData() {
                $content = $this->newContent( 'hello world.' );
 
                $this->assertEquals( 'hello world.', $content->getNativeData() );
        }
 
+       /**
+        * @covers TextContent::getWikitextForTransclusion
+        */
        public function testGetWikitextForTransclusion() {
                $content = $this->newContent( 'hello world.' );
 
                $this->assertEquals( 'hello world.', $content->getWikitextForTransclusion() );
        }
 
+       /**
+        * @covers TextContent::getModel
+        */
        public function testGetModel() {
                $content = $this->newContent( "hello world." );
 
                $this->assertEquals( CONTENT_MODEL_TEXT, $content->getModel() );
        }
 
+       /**
+        * @covers TextContent::getContentHandler
+        */
        public function testGetContentHandler() {
                $content = $this->newContent( "hello world." );
 
@@ -302,6 +341,7 @@ class TextContentTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider dataIsEmpty
+        * @covers TextContent::isEmpty
         */
        public function testIsEmpty( $text, $empty ) {
                $content = $this->newContent( $text );
@@ -321,6 +361,7 @@ class TextContentTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider dataEquals
+        * @covers TextContent::equals
         */
        public function testEquals( Content $a, Content $b = null, $equal = false ) {
                $this->assertEquals( $equal, $a->equals( $b ) );
@@ -342,6 +383,7 @@ class TextContentTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider dataGetDeletionUpdates
+        * @covers TextContent::getDeletionUpdates
         */
        public function testDeletionUpdates( $title, $model, $text, $expectedStuff ) {
                $ns = $this->getDefaultWikitextNS();
@@ -410,6 +452,7 @@ class TextContentTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider provideConvert
+        * @covers TextContent::convert
         */
        public function testConvert( $text, $model, $lossy, $expectedNative ) {
                $content = $this->newContent( $text );