Merge "add mw-diff-* classes to view diff page header links"
[lhc/web/wiklou.git] / tests / phpunit / includes / content / ContentHandlerTest.php
index 2add9f2..f744973 100644 (file)
@@ -312,6 +312,23 @@ class ContentHandlerTest extends MediaWikiTestCase {
                }
        }
 
+       /*
+        * Test if we become a "Created blank page" summary from getAutoSummary if no Content added to
+        * page.
+        */
+       public function testGetAutosummary() {
+               $content = new DummyContentHandlerForTesting( CONTENT_MODEL_WIKITEXT );
+               $title = Title::newFromText( 'Help:Test' );
+               // Create a new content object with no content
+               $newContent = ContentHandler::makeContent( '', $title, null, null, CONTENT_MODEL_WIKITEXT );
+               // first check, if we become a blank page created summary with the right bitmask
+               $autoSummary = $content->getAutosummary( null, $newContent, 97 );
+               $this->assertEquals( $autoSummary, 'Created blank page' );
+               // now check, what we become with another bitmask
+               $autoSummary = $content->getAutosummary( null, $newContent, 92 );
+               $this->assertEquals( $autoSummary, '' );
+       }
+
        /*
        public function testSupportsSections() {
                $this->markTestIncomplete( "not yet implemented" );
@@ -431,7 +448,7 @@ class DummyContentForTesting extends AbstractContent {
         * Returns native represenation of the data. Interpretation depends on the data model used,
         * as given by getDataModel().
         *
-        * @return mixed the native representation of the content. Could be a string, a nested array
+        * @return mixed The native representation of the content. Could be a string, a nested array
         *  structure, an object, a binary blob... anything, really.
         */
        public function getNativeData() {
@@ -459,7 +476,7 @@ class DummyContentForTesting extends AbstractContent {
         * return $this. That is,  $copy === $original may be true, but only for imutable content
         * objects.
         *
-        * @return Content. A copy of this object.
+        * @return Content A copy of this object
         */
        public function copy() {
                return $this;
@@ -469,7 +486,7 @@ class DummyContentForTesting extends AbstractContent {
         * Returns true if this content is countable as a "real" wiki page, provided
         * that it's also in a countable location (e.g. a current revision in the main namespace).
         *
-        * @param bool $hasLinks if it is known whether this content contains links,
+        * @param bool $hasLinks If it is known whether this content contains links,
         * provide this information here, to avoid redundant parsing to find out.
         * @return bool
         */
@@ -481,7 +498,7 @@ class DummyContentForTesting extends AbstractContent {
         * @param Title $title
         * @param int $revId Unused.
         * @param null|ParserOptions $options
-        * @param bool $generateHtml whether to generate Html (default: true). If false, the result
+        * @param bool $generateHtml Whether to generate Html (default: true). If false, the result
         *  of calling getText() on the ParserOutput object returned by this method is undefined.
         *
         * @return ParserOutput
@@ -497,7 +514,7 @@ class DummyContentForTesting extends AbstractContent {
         *
         * @param Title $title Context title for parsing
         * @param int|null $revId Revision ID (for {{REVISIONID}})
-        * @param ParserOptions|null $options Parser options
+        * @param ParserOptions $options Parser options
         * @param bool $generateHtml Whether or not to generate HTML
         * @param ParserOutput &$output The output object to fill (reference).
         */