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

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


Fix DocumentationParserFunction name/class

No logic or process change.

Change-Id: If3e0f25ebf06407e5f720b3fee5f10be4e7eb4e9
---
M SemanticMediaWiki.hooks.php
M includes/Setup.php
R includes/parserhooks/DocumentationParserFunction.php
A tests/phpunit/includes/parserhooks/DocumentationParserFunctionTest.php
4 files changed, 65 insertions(+), 10 deletions(-)

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



diff --git a/SemanticMediaWiki.hooks.php b/SemanticMediaWiki.hooks.php
index 2a4cbff..0cd477e 100644
--- a/SemanticMediaWiki.hooks.php
+++ b/SemanticMediaWiki.hooks.php
@@ -291,6 +291,7 @@
                        'parserhooks/ShowParserFunction',
                        'parserhooks/ConceptParserFunction',
                        'parserhooks/DeclareParserFunction',
+                       'parserhooks/DocumentationParserFunction',
 
                        'printers/ResultPrinters',
 
diff --git a/includes/Setup.php b/includes/Setup.php
index ea9b205..64b0490 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -51,7 +51,7 @@
        $wgHooks['AdminLinks'][]          = 'SMWHooks::addToAdminLinks';
        $wgHooks['PageSchemasRegisterHandlers'][] = 
'SMWHooks::onPageSchemasRegistration';
 
-       $wgHooks['ParserFirstCallInit'][] = 'SMWSMWDoc::staticInit';
+       $wgHooks['ParserFirstCallInit'][] = 
'SMW\DocumentationParserFunction::staticInit';
        $wgHooks['ParserFirstCallInit'][] = 'SMWInfo::staticInit';
 
        $wgHooks['InternalParseBeforeLinks'][] = 
'SMWParserExtensions::onInternalParseBeforeLinks'; // parse annotations in 
[[link syntax]]
@@ -206,13 +206,13 @@
        $wgAutoloadClasses['SMWInfo']                   = $phDir . 
'SMW_Info.php';
        $wgAutoloadClasses['SMW\ConceptParserFunction'] = $phDir . 
'ConceptParserFunction.php';
        $wgAutoloadClasses['SMW\DeclareParserFunction'] = $phDir . 
'DeclareParserFunction.php';
-       $wgAutoloadClasses['SMWSMWDoc']                 = $phDir . 
'SMW_SMWDoc.php';
-       $wgAutoloadClasses['SMW\ParserParameterFormatter'] = $phDir . 
'ParserParameterFormatter.php';
-       $wgAutoloadClasses['SMW\SetParserFunction']        = $phDir . 
'SetParserFunction.php';
-       $wgAutoloadClasses['SMW\SubobjectParserFunction']  = $phDir . 
'SubobjectParserFunction.php';
-       $wgAutoloadClasses['SMW\Subobject']              = $phDir . 
'Subobject.php';
-       $wgAutoloadClasses['SMW\RecurringEventsParserFunction'] = $phDir . 
'RecurringEventsParserFunction.php';
        $wgAutoloadClasses['SMW\RecurringEvents']       = $phDir . 
'RecurringEvents.php';
+       $wgAutoloadClasses['SMW\Subobject']             = $phDir . 
'Subobject.php';
+       $wgAutoloadClasses['SMW\DocumentationParserFunction']   = $phDir . 
'DocumentationParserFunction.php';
+       $wgAutoloadClasses['SMW\ParserParameterFormatter']      = $phDir . 
'ParserParameterFormatter.php';
+       $wgAutoloadClasses['SMW\SetParserFunction']             = $phDir . 
'SetParserFunction.php';
+       $wgAutoloadClasses['SMW\SubobjectParserFunction']       = $phDir . 
'SubobjectParserFunction.php';
+       $wgAutoloadClasses['SMW\RecurringEventsParserFunction'] = $phDir . 
'RecurringEventsParserFunction.php';
 
        // Stores & queries
        $wgAutoloadClasses['SMWQueryProcessor']         = $smwgIP . 
'includes/SMW_QueryProcessor.php';
diff --git a/includes/parserhooks/SMW_SMWDoc.php 
b/includes/parserhooks/DocumentationParserFunction.php
similarity index 95%
rename from includes/parserhooks/SMW_SMWDoc.php
rename to includes/parserhooks/DocumentationParserFunction.php
index 9c07923..ffb9496 100644
--- a/includes/parserhooks/SMW_SMWDoc.php
+++ b/includes/parserhooks/DocumentationParserFunction.php
@@ -1,5 +1,10 @@
 <?php
 
+namespace SMW;
+
+use Parser;
+use SMWQueryProcessor;
+
 /**
  * Class for the 'smwdoc' parser hooks,
  * which displays parameter documentation for a specified result format.
@@ -12,7 +17,7 @@
  * @licence GNU GPL v3
  * @author Jeroen De Dauw < jeroended...@gmail.com >
  */
-class SMWSMWDoc extends ParserHook {
+class DocumentationParserFunction extends \ParserHook {
 
        /**
         * Field to store the value of the language parameter.
@@ -174,7 +179,7 @@
         *
         * @return string
         */
-       protected function getDescriptionRow( IParamDefinition $parameter, 
$hasAliases ) {
+       protected function getDescriptionRow( \IParamDefinition $parameter, 
$hasAliases ) {
                if ( $hasAliases ) {
                        $aliases = $parameter->getAliases();
                        $aliases = count( $aliases ) > 0 ? implode( ', ', 
$aliases ) : '-';
@@ -210,7 +215,7 @@
         */
        protected function getFormatParameters( $format ) {
                if ( array_key_exists( $format, $GLOBALS['smwgResultFormats'] ) 
) {
-                       return ParamDefinition::getCleanDefinitions(
+                       return \ParamDefinition::getCleanDefinitions(
                                SMWQueryProcessor::getResultPrinter( $format 
)->getParamDefinitions( SMWQueryProcessor::getParameters() )
                        );
                }
diff --git 
a/tests/phpunit/includes/parserhooks/DocumentationParserFunctionTest.php 
b/tests/phpunit/includes/parserhooks/DocumentationParserFunctionTest.php
new file mode 100644
index 0000000..f158742
--- /dev/null
+++ b/tests/phpunit/includes/parserhooks/DocumentationParserFunctionTest.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace SMW\Test;
+
+use SMW\DocumentationParserFunction;
+
+/**
+ * Tests for the SMW\DocumentationParserFunction 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 DocumentationParserFunctionTest extends \MediaWikiTestCase {
+
+       // Will be extended in a follow-up
+
+       /**
+        * Test instance
+        *
+        */
+       public function testConstructor() {
+               $instance = new DocumentationParserFunction();
+               $this->assertInstanceOf( 'SMW\DocumentationParserFunction', 
$instance );
+       }
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If3e0f25ebf06407e5f720b3fee5f10be4e7eb4e9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Mwjames <jamesin.hongkon...@gmail.com>
Gerrit-Reviewer: Mwjames <jamesin.hongkon...@gmail.com>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to