Mwjames has uploaded a new change for review.
https://gerrit.wikimedia.org/r/56784
Change subject: Fix RecurringEventsParserFunction name/class
......................................................................
Fix RecurringEventsParserFunction name/class
No logic or process change.
Change-Id: I1a580974f618eeca1b904cbc2c7ba55623fed78d
---
M SemanticMediaWiki.hooks.php
M includes/Setup.php
M includes/parserhooks/RecurringEventsParserFunction.php
A tests/phpunit/includes/parserhooks/RecurringEventsParserFunctionTest.php
4 files changed, 57 insertions(+), 6 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMediaWiki
refs/changes/84/56784/1
diff --git a/SemanticMediaWiki.hooks.php b/SemanticMediaWiki.hooks.php
index 6546d43..2677985 100644
--- a/SemanticMediaWiki.hooks.php
+++ b/SemanticMediaWiki.hooks.php
@@ -130,7 +130,7 @@
$parser->setFunctionHook( 'subobject', array(
'SMW\SubobjectParserFunction', 'render' ) );
$parser->setFunctionHook( 'concept', array( 'SMWConcept',
'render' ) );
$parser->setFunctionHook( 'set', array(
'SMW\SetParserFunction', 'render' ) );
- $parser->setFunctionHook( 'set_recurring_event', array(
'SMW\RecurringEventsHandler', 'render' ) );
+ $parser->setFunctionHook( 'set_recurring_event', array(
'SMW\RecurringEventsParserFunction', 'render' ) );
$parser->setFunctionHook( 'declare', array( 'SMWDeclare',
'render' ), SFH_OBJECT_ARGS );
return true;
@@ -286,6 +286,7 @@
'parserhooks/Subobject',
'parserhooks/SubobjectParserFunction',
'parserhooks/RecurringEvents',
+ 'parserhooks/RecurringEventsParserFunction',
'printers/ResultPrinters',
diff --git a/includes/Setup.php b/includes/Setup.php
index 07b6372..dae8de1 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -211,7 +211,7 @@
$wgAutoloadClasses['SMW\SetParserFunction'] = $phDir .
'SetParserFunction.php';
$wgAutoloadClasses['SMW\SubobjectParserFunction'] = $phDir .
'SubobjectParserFunction.php';
$wgAutoloadClasses['SMW\Subobject'] = $phDir .
'Subobject.php';
- $wgAutoloadClasses['SMW\RecurringEventsHandler'] = $phDir .
'RecurringEventsParserFunction.php';
+ $wgAutoloadClasses['SMW\RecurringEventsParserFunction'] = $phDir .
'RecurringEventsParserFunction.php';
$wgAutoloadClasses['SMW\RecurringEvents'] = $phDir .
'RecurringEvents.php';
// Stores & queries
diff --git a/includes/parserhooks/RecurringEventsParserFunction.php
b/includes/parserhooks/RecurringEventsParserFunction.php
index f4a86e8..00ea105 100644
--- a/includes/parserhooks/RecurringEventsParserFunction.php
+++ b/includes/parserhooks/RecurringEventsParserFunction.php
@@ -33,7 +33,7 @@
*
* @author mwjames
*/
-class RecurringEventsHandler {
+class RecurringEventsParserFunction {
/**
* Method for handling the set_recurring_event parser function.
@@ -63,13 +63,13 @@
$parameters = $events->getParameters();
// Add individual date string as parameter in order to
be handled
- // equally by the SubobjectHandler as member of the
same instance
+ // equally by the SubobjectParserFunction as member of
the same instance
// once the ParserParameter class is fixed use a
// $parameters->addParameter( key, value ) instead
$parameters[$events->getProperty()][] = $date_str;
// Instantiate subobject handler for each new date
- $handler = new SubobjectHandler( $subject, $parameters
);
+ $handler = new SubobjectParserFunction( $subject,
$parameters );
// Store an individual subobject
SMWParseData::getSMWData( $parser
)->addPropertyObjectValue(
@@ -81,7 +81,7 @@
$errors = array_merge(
$handler->getSubobject()->getErrors(), $errors );
}
- // See comments in SubobjectHandler class
+ // See comments in SubobjectParserFunction class
return smwfEncodeMessages( $errors , 'warning', '' , false );
}
}
diff --git
a/tests/phpunit/includes/parserhooks/RecurringEventsParserFunctionTest.php
b/tests/phpunit/includes/parserhooks/RecurringEventsParserFunctionTest.php
new file mode 100644
index 0000000..38785b7
--- /dev/null
+++ b/tests/phpunit/includes/parserhooks/RecurringEventsParserFunctionTest.php
@@ -0,0 +1,50 @@
+<?php
+
+namespace SMW\Test;
+
+use SMW\RecurringEventsParserFunction;
+
+/**
+ * Tests for the SMW\RecurringEventsParserFunction 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 RecurringEventsParserFunctionTest extends \MediaWikiTestCase {
+
+ // Will be extended in a follow-up
+
+ /**
+ * Test instance
+ *
+ */
+ public function testConstructor() {
+ $instance = new RecurringEventsParserFunction();
+ $this->assertInstanceOf( 'SMW\RecurringEventsParserFunction',
$instance );
+ }
+
+}
--
To view, visit https://gerrit.wikimedia.org/r/56784
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a580974f618eeca1b904cbc2c7ba55623fed78d
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