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

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


Fix ShowParserFunction name/class

No logic or process change.

Change-Id: Id7cede5579bb444b30cf73d859976e634e5c6615
---
M SemanticMediaWiki.hooks.php
M includes/Setup.php
M includes/parserhooks/ShowParserFunction.php
A tests/phpunit/includes/parserhooks/ShowParserFunctionTest.php
4 files changed, 62 insertions(+), 5 deletions(-)

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



diff --git a/SemanticMediaWiki.hooks.php b/SemanticMediaWiki.hooks.php
index 80adb27..b2eef67 100644
--- a/SemanticMediaWiki.hooks.php
+++ b/SemanticMediaWiki.hooks.php
@@ -126,7 +126,7 @@
         */
        public static function onParserFirstCallInit( Parser &$parser ) {
                $parser->setFunctionHook( 'ask', array( 
'SMW\AskParserFunction', 'render' ) );
-               $parser->setFunctionHook( 'show', array( 'SMWShow', 'render' ) 
);
+               $parser->setFunctionHook( 'show', array( 
'SMW\ShowParserFunction', 'render' ) );
                $parser->setFunctionHook( 'subobject', array( 
'SMW\SubobjectParserFunction', 'render' ) );
                $parser->setFunctionHook( 'concept', array( 'SMWConcept', 
'render' ) );
                $parser->setFunctionHook( 'set', array( 
'SMW\SetParserFunction', 'render' ) );
@@ -287,7 +287,8 @@
                        'parserhooks/SubobjectParserFunction',
                        'parserhooks/RecurringEvents',
                        'parserhooks/RecurringEventsParserFunction',
-                       'parserhooks/AskParserFunctionTest',
+                       'parserhooks/AskParserFunction',
+                       'parserhooks/ShowParserFunction',
 
                        'printers/ResultPrinters',
 
diff --git a/includes/Setup.php b/includes/Setup.php
index b726a5f..6c86d02 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -202,7 +202,7 @@
        // Parser hooks
        $phDir = $smwgIP . 'includes/parserhooks/';
        $wgAutoloadClasses['SMW\AskParserFunction']     = $phDir . 
'AskParserFunction.php';
-       $wgAutoloadClasses['SMWShow']                   = $phDir . 
'ShowParserFunction.php';
+       $wgAutoloadClasses['SMW\ShowParserFunction']    = $phDir . 
'ShowParserFunction.php';
        $wgAutoloadClasses['SMWInfo']                   = $phDir . 
'SMW_Info.php';
        $wgAutoloadClasses['SMWConcept']                = $phDir . 
'ConceptParserFunction.php';
        $wgAutoloadClasses['SMWDeclare']                = $phDir . 
'SMW_Declare.php';
diff --git a/includes/parserhooks/ShowParserFunction.php 
b/includes/parserhooks/ShowParserFunction.php
index 3cf22fa..79bb26c 100644
--- a/includes/parserhooks/ShowParserFunction.php
+++ b/includes/parserhooks/ShowParserFunction.php
@@ -1,4 +1,11 @@
 <?php
+
+namespace SMW;
+
+use Parser;
+use SMWQueryProcessor;
+use SMWOutputs;
+
 /**
  * @file
  * @since 1.5.3
@@ -18,7 +25,7 @@
  * @author Markus Krötzsch
  * @author Jeroen De Dauw
  */
-class SMWShow {
+class ShowParserFunction {
 
        /**
         * Method for handling the show parser function.
@@ -41,7 +48,7 @@
                        $result = SMWQueryProcessor::getResultFromQuery( 
$query, $params, SMW_OUTPUT_WIKI, SMWQueryProcessor::INLINE_QUERY );
 
                        $queryKey = hash( 'md4', implode( '|', $rawParams ) , 
false );
-                       SMWAsk::addQueryData( $queryKey, $query, $params, 
$parser );
+                       AskParserFunction::addQueryData( $queryKey, $query, 
$params, $parser );
                } else {
                        $result = smwfEncodeMessages( array( wfMessage( 
'smw_iq_disabled' )->inContentLanguage()->text() ) );
                }
diff --git a/tests/phpunit/includes/parserhooks/ShowParserFunctionTest.php 
b/tests/phpunit/includes/parserhooks/ShowParserFunctionTest.php
new file mode 100644
index 0000000..9efbb00
--- /dev/null
+++ b/tests/phpunit/includes/parserhooks/ShowParserFunctionTest.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace SMW\Test;
+
+use SMW\ShowParserFunction;
+
+/**
+ * Tests for the SMW\ShowParserFunction 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 ShowParserFunctionTest extends \MediaWikiTestCase {
+
+       // Will be extended in a follow-up
+
+       /**
+        * Test instance
+        *
+        */
+       public function testConstructor() {
+               $instance = new ShowParserFunction();
+               $this->assertInstanceOf( 'SMW\ShowParserFunction', $instance );
+       }
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id7cede5579bb444b30cf73d859976e634e5c6615
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