Mwjames has uploaded a new change for review.
https://gerrit.wikimedia.org/r/56787
Change subject: Fix ConceptParserFunction name/class
......................................................................
Fix ConceptParserFunction name/class
No logic or process change.
Change-Id: Iaf06a92eb4451460b34accb01e7fa1193fd26448
---
M SemanticMediaWiki.hooks.php
M includes/Setup.php
M includes/parserhooks/ConceptParserFunction.php
A tests/phpunit/includes/parserhooks/ConceptParserFunctionTest.php
4 files changed, 63 insertions(+), 5 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMediaWiki
refs/changes/87/56787/1
diff --git a/SemanticMediaWiki.hooks.php b/SemanticMediaWiki.hooks.php
index b2eef67..c338746 100644
--- a/SemanticMediaWiki.hooks.php
+++ b/SemanticMediaWiki.hooks.php
@@ -128,7 +128,7 @@
$parser->setFunctionHook( 'ask', array(
'SMW\AskParserFunction', 'render' ) );
$parser->setFunctionHook( 'show', array(
'SMW\ShowParserFunction', 'render' ) );
$parser->setFunctionHook( 'subobject', array(
'SMW\SubobjectParserFunction', 'render' ) );
- $parser->setFunctionHook( 'concept', array( 'SMWConcept',
'render' ) );
+ $parser->setFunctionHook( 'concept', array(
'SMW\ConceptParserFunction', 'render' ) );
$parser->setFunctionHook( 'set', array(
'SMW\SetParserFunction', 'render' ) );
$parser->setFunctionHook( 'set_recurring_event', array(
'SMW\RecurringEventsParserFunction', 'render' ) );
$parser->setFunctionHook( 'declare', array( 'SMWDeclare',
'render' ), SFH_OBJECT_ARGS );
@@ -289,6 +289,7 @@
'parserhooks/RecurringEventsParserFunction',
'parserhooks/AskParserFunction',
'parserhooks/ShowParserFunction',
+ 'parserhooks/ConceptParserFunction',
'printers/ResultPrinters',
diff --git a/includes/Setup.php b/includes/Setup.php
index 6c86d02..c3467ed 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -204,7 +204,7 @@
$wgAutoloadClasses['SMW\AskParserFunction'] = $phDir .
'AskParserFunction.php';
$wgAutoloadClasses['SMW\ShowParserFunction'] = $phDir .
'ShowParserFunction.php';
$wgAutoloadClasses['SMWInfo'] = $phDir .
'SMW_Info.php';
- $wgAutoloadClasses['SMWConcept'] = $phDir .
'ConceptParserFunction.php';
+ $wgAutoloadClasses['SMW\ConceptParserFunction'] = $phDir .
'ConceptParserFunction.php';
$wgAutoloadClasses['SMWDeclare'] = $phDir .
'SMW_Declare.php';
$wgAutoloadClasses['SMWSMWDoc'] = $phDir .
'SMW_SMWDoc.php';
$wgAutoloadClasses['SMW\ParserParameterFormatter'] = $phDir .
'ParserParameterFormatter.php';
diff --git a/includes/parserhooks/ConceptParserFunction.php
b/includes/parserhooks/ConceptParserFunction.php
index 9219129..0cf2976 100644
--- a/includes/parserhooks/ConceptParserFunction.php
+++ b/includes/parserhooks/ConceptParserFunction.php
@@ -1,5 +1,13 @@
<?php
+namespace SMW;
+
+use Parser;
+use SMWParseData;
+use SMWDIProperty;
+use SMWOutputs;
+use SMWQueryProcessor;
+
/**
* @since 1.5.3
* @file
@@ -18,7 +26,7 @@
* @author Markus Krötzsch
* @author Jeroen De Dauw
*/
-class SMWConcept {
+class ConceptParserFunction {
/**
* Method for handling the ask concept function.
@@ -68,12 +76,12 @@
$concept_text = $query->getDescription()->getQueryString();
if ( !is_null( SMWParseData::getSMWData( $parser ) ) ) {
- $diConcept = new SMWDIConcept( $concept_text,
$concept_docu, $query->getDescription()->getQueryFeatures(),
$query->getDescription()->getSize(), $query->getDescription()->getDepth() );
+ $diConcept = new \SMWDIConcept( $concept_text,
$concept_docu, $query->getDescription()->getQueryFeatures(),
$query->getDescription()->getSize(), $query->getDescription()->getDepth() );
SMWParseData::getSMWData( $parser
)->addPropertyObjectValue( $pconc, $diConcept );
}
// display concept box:
- $rdflink = SMWInfolink::newInternalLink(
+ $rdflink = \SMWInfolink::newInternalLink(
wfMessage( 'smw_viewasrdf'
)->inContentLanguage()->text(),
$wgContLang->getNsText( NS_SPECIAL ) . ':ExportRDF/' .
$title->getPrefixedText(), 'rdflink'
);
diff --git a/tests/phpunit/includes/parserhooks/ConceptParserFunctionTest.php
b/tests/phpunit/includes/parserhooks/ConceptParserFunctionTest.php
new file mode 100644
index 0000000..8479232
--- /dev/null
+++ b/tests/phpunit/includes/parserhooks/ConceptParserFunctionTest.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace SMW\Test;
+
+use SMW\ConceptParserFunction;
+
+/**
+ * Tests for the SMW\ConceptParserFunction 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 ConceptParserFunctionTest extends \MediaWikiTestCase {
+
+ // Will be extended in a follow-up
+
+ /**
+ * Test instance
+ *
+ */
+ public function testConstructor() {
+ $instance = new ConceptParserFunction();
+ $this->assertInstanceOf( 'SMW\ConceptParserFunction', $instance
);
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/56787
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf06a92eb4451460b34accb01e7fa1193fd26448
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Mwjames <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits