jenkins-bot has submitted this change and it was merged.

Change subject: Fix InfoParserFunction name/class
......................................................................


Fix InfoParserFunction name/class

No logic or process change.

Change-Id: Iaab8be5a70852aa4710229d154f5ff4619283817
---
M SemanticMediaWiki.hooks.php
M includes/Setup.php
R includes/parserhooks/InfoParserFunction.php
A tests/phpunit/includes/parserhooks/InfoParserFunctionTest.php
4 files changed, 81 insertions(+), 26 deletions(-)

Approvals:
  Mwjames: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/SemanticMediaWiki.hooks.php b/SemanticMediaWiki.hooks.php
index 0cd477e..778117e 100644
--- a/SemanticMediaWiki.hooks.php
+++ b/SemanticMediaWiki.hooks.php
@@ -292,6 +292,7 @@
                        'parserhooks/ConceptParserFunction',
                        'parserhooks/DeclareParserFunction',
                        'parserhooks/DocumentationParserFunction',
+                       'parserhooks/InfoParserFunction',
 
                        'printers/ResultPrinters',
 
diff --git a/includes/Setup.php b/includes/Setup.php
index 64b0490..09de3af 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -52,7 +52,7 @@
        $wgHooks['PageSchemasRegisterHandlers'][] = 
'SMWHooks::onPageSchemasRegistration';
 
        $wgHooks['ParserFirstCallInit'][] = 
'SMW\DocumentationParserFunction::staticInit';
-       $wgHooks['ParserFirstCallInit'][] = 'SMWInfo::staticInit';
+       $wgHooks['ParserFirstCallInit'][] = 
'SMW\InfoParserFunction::staticInit';
 
        $wgHooks['InternalParseBeforeLinks'][] = 
'SMWParserExtensions::onInternalParseBeforeLinks'; // parse annotations in 
[[link syntax]]
        $wgHooks['ArticleDelete'][] = 'SMWParseData::onArticleDelete'; // 
delete annotations
@@ -203,7 +203,7 @@
        $phDir = $smwgIP . 'includes/parserhooks/';
        $wgAutoloadClasses['SMW\AskParserFunction']     = $phDir . 
'AskParserFunction.php';
        $wgAutoloadClasses['SMW\ShowParserFunction']    = $phDir . 
'ShowParserFunction.php';
-       $wgAutoloadClasses['SMWInfo']                   = $phDir . 
'SMW_Info.php';
+       $wgAutoloadClasses['SMW\InfoParserFunction']    = $phDir . 
'InfoParserFunction.php';
        $wgAutoloadClasses['SMW\ConceptParserFunction'] = $phDir . 
'ConceptParserFunction.php';
        $wgAutoloadClasses['SMW\DeclareParserFunction'] = $phDir . 
'DeclareParserFunction.php';
        $wgAutoloadClasses['SMW\RecurringEvents']       = $phDir . 
'RecurringEvents.php';
diff --git a/includes/parserhooks/SMW_Info.php 
b/includes/parserhooks/InfoParserFunction.php
similarity index 89%
rename from includes/parserhooks/SMW_Info.php
rename to includes/parserhooks/InfoParserFunction.php
index cf41700..d91c48c 100644
--- a/includes/parserhooks/SMW_Info.php
+++ b/includes/parserhooks/InfoParserFunction.php
@@ -1,30 +1,35 @@
 <?php
 
+namespace SMW;
+
+use Parser;
+use SMWOutputs;
+
 /**
  * Class for the 'info' parser functions.
- * 
+ *
  * @since 1.5.3
- * 
+ *
  * @file SMW_Info.php
  * @ingroup SMW
  * @ingroup ParserHooks
- * 
+ *
  * @author Markus Krötzsch
  * @author Jeroen De Dauw
  */
-class SMWInfo extends ParserHook {
-       
+class InfoParserFunction extends \ParserHook {
+
        /**
         * Renders and returns the output.
         * @see ParserHook::render
-        * 
+        *
         * @since 1.7
-        * 
+        *
         * @param array $parameters
-        * 
+        *
         * @return string
         */
-       public function render( array $parameters ) {           
+       public function render( array $parameters ) {
                /**
                 * Non-escaping is safe bacause a user's message is passed 
through parser, which will
                 * handle unsafe HTM elements.
@@ -43,49 +48,49 @@
                else {
                        SMWOutputs::commitToParser( $this->parser );
                }
-               
-               return $result;         
+
+               return $result;
        }
-       
+
        /**
         * No LSB in pre-5.3 PHP *sigh*.
         * This is to be refactored as soon as php >=5.3 becomes acceptable.
-        */     
+        */
        public static function staticInit( Parser &$parser ) {
                $instance = new self;
                return $instance->init( $parser );
-       }       
-       
+       }
+
        /**
         * Gets the name of the parser hook.
         * @see ParserHook::getName
-        * 
+        *
         * @since 1.7
-        * 
+        *
         * @return string
         */
        protected function getName() {
                return 'info';
        }
-       
+
        /**
         * Returns the list of default parameters.
         * @see ParserHook::getDefaultParameters
-        * 
+        *
         * @since 1.6
-        * 
+        *
         * @return array
         */
        protected function getDefaultParameters( $type ) {
                return array( 'message', 'icon' );
        }
-       
+
        /**
         * Returns an array containing the parameter info.
         * @see ParserHook::getParameterInfo
-        * 
+        *
         * @since 1.7
-        * 
+        *
         * @return array
         */
        protected function getParameterInfo( $type ) {
@@ -102,5 +107,5 @@
                        ),
                );
        }
-       
+
 }
diff --git a/tests/phpunit/includes/parserhooks/InfoParserFunctionTest.php 
b/tests/phpunit/includes/parserhooks/InfoParserFunctionTest.php
new file mode 100644
index 0000000..8188fb1
--- /dev/null
+++ b/tests/phpunit/includes/parserhooks/InfoParserFunctionTest.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace SMW\Test;
+
+use SMW\InfoParserFunction;
+
+/**
+ * Tests for the SMW\InfoParserFunction class
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @since 1.9
+ *
+ * @ingroup SMW
+ * @ingroup Test
+ *
+ * @group SMW
+ * @group SMWExtension
+ *
+ * @licence GNU GPL v2+
+ * @author mwjames
+ */
+class InfoParserFunctionTest extends \MediaWikiTestCase {
+
+       // Will be extended in a follow-up
+
+       /**
+        * Test instance
+        *
+        */
+       public function testConstructor() {
+               $instance = new InfoParserFunction();
+               $this->assertInstanceOf( 'SMW\InfoParserFunction', $instance );
+       }
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/56853
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaab8be5a70852aa4710229d154f5ff4619283817
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Mwjames <[email protected]>
Gerrit-Reviewer: Mwjames <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to