Mwjames has uploaded a new change for review.
https://gerrit.wikimedia.org/r/90713
Change subject: Remove clutter
......................................................................
Remove clutter
Change-Id: I8a9cdf3187c8e532d84665e2cd8a80dcd2886238
---
M SemanticMediaWiki.hooks.php
M includes/Setup.php
M includes/Subobject.php
M includes/dic/SharedDependencyContainer.php
M includes/parserhooks/ParserFunctionFactory.php
M includes/parserhooks/SubobjectParserFunction.php
M tests/phpunit/includes/SubobjectTest.php
M tests/phpunit/includes/dic/SharedDependencyContainerTest.php
M tests/phpunit/includes/parserhooks/ParserFunctionFactoryTest.php
M tests/phpunit/includes/parserhooks/SubobjectParserFunctionTest.php
10 files changed, 174 insertions(+), 272 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMediaWiki
refs/changes/13/90713/1
diff --git a/SemanticMediaWiki.hooks.php b/SemanticMediaWiki.hooks.php
index b6be814..768e231 100644
--- a/SemanticMediaWiki.hooks.php
+++ b/SemanticMediaWiki.hooks.php
@@ -191,7 +191,6 @@
* @return boolean
*/
public static function onParserFirstCallInit( Parser &$parser ) {
- $parser->setFunctionHook( 'subobject', array(
'SMW\SubobjectParserFunction', 'render' ) );
$parser->setFunctionHook( 'concept', array(
'SMW\ConceptParserFunction', 'render' ) );
$parser->setFunctionHook( 'set', array(
'SMW\SetParserFunction', 'render' ) );
$parser->setFunctionHook( 'set_recurring_event', array(
'SMW\RecurringEventsParserFunction', 'render' ) );
diff --git a/includes/Setup.php b/includes/Setup.php
index 461cae5..401f1ee 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -510,6 +510,16 @@
return $settings->get( 'smwgQEnabled' ) ?
$show->parse( func_get_args() ) : $show->disabled();
} );
+ /**
+ * {{#subobject}}
+ *
+ * @since 1.9
+ */
+ $parser->setFunctionHook( 'subobject', function(
$parser ) use ( $builder ) {
+ $instance = $builder->newObject(
'SubobjectParserFunction', array( 'Parser' => $parser ) );
+ return $instance->parse(
ParameterFormatterFactory::newFromArray( func_get_args() ) );
+ } );
+
return true;
};
diff --git a/includes/Subobject.php b/includes/Subobject.php
index 21090e9..fd81377 100644
--- a/includes/Subobject.php
+++ b/includes/Subobject.php
@@ -7,22 +7,19 @@
use SMWDataValue;
use Title;
+use InvalidArgumentException;
/**
- * Class to interact with a 'subobject'
+ * Provides a subobject
*
- * @file
- *
- * @license GNU GPL v2+
- * @since 1.9
- *
- * @author mwjames
- */
-
-/**
- * Class to interact with a 'subobject'
+ * @see http://www.semantic-mediawiki.org/wiki/Help:Subobject
*
* @ingroup SMW
+ *
+ * @licence GNU GPL v2+
+ * @since 1.9
+ *
+ * @author mwjames
*/
class Subobject {
@@ -48,26 +45,14 @@
}
/**
- * Convenience method for immediate object instantiation that creates a
- * subobject for a given title and identifier
- *
- * @par Example:
- * @code
- * $subobject = Subobject::newFromId( 'Foo', 'Bar' );
- * $subobject->addDataValue( $dataValue )
- * @endcode
+ * Returns the Title object
*
* @since 1.9
*
- * @param Title $title
- * @param string|false $identifier
- *
- * @return Subobject
+ * @return Title
*/
- public static function newFromId( Title $title, $identifier = false ) {
- $instance = new self( $title );
- $instance->setSemanticData( $identifier );
- return $instance;
+ public function getTitle() {
+ return $this->title;
}
/**
@@ -125,21 +110,24 @@
* @param string $identifier
*
* @return SMWContainerSemanticData
+ * @throws InvalidArgumentException
*/
public function setSemanticData( $identifier ) {
- if ( $identifier != '' ) {
- $this->identifier = $identifier;
-
- $diSubWikiPage = new DIWikiPage(
- $this->title->getDBkey(),
- $this->title->getNamespace(),
- $this->title->getInterwiki(),
- $identifier
- );
-
- return $this->semanticData = new
SMWContainerSemanticData( $diSubWikiPage );
+ if ( $identifier === '' ) {
+ throw new InvalidArgumentException( 'The indentifier is
empty' );
}
+
+ $this->identifier = $identifier;
+
+ $diSubWikiPage = new DIWikiPage(
+ $this->title->getDBkey(),
+ $this->title->getNamespace(),
+ $this->title->getInterwiki(),
+ $identifier
+ );
+
+ $this->semanticData = new SMWContainerSemanticData(
$diSubWikiPage );
}
@@ -183,7 +171,9 @@
* @code
* $dataValue = DataValueFactory::newPropertyValue( $userProperty,
$userValue )
*
- * Subobject::newFromId( 'Foo', 'Bar' )->addDataValue( $dataValue )
+ * $subobject = new Subobject( 'Foo' );
+ * $subobject->setSemanticData( 'Bar' );
+ * $subobject->addDataValue( $dataValue )
* @endcode
*
* @since 1.9
diff --git a/includes/dic/SharedDependencyContainer.php
b/includes/dic/SharedDependencyContainer.php
index b3db8ba..0a6821b 100644
--- a/includes/dic/SharedDependencyContainer.php
+++ b/includes/dic/SharedDependencyContainer.php
@@ -248,6 +248,33 @@
},
/**
+ * SubobjectParserFunction object definition
+ *
+ * @since 1.9
+ *
+ * @return SubobjectParserFunction
+ */
+ 'SubobjectParserFunction' => function (
DependencyBuilder $builder ) {
+
+ $parser = $builder->getArgument( 'Parser' );
+
+ $parserData = $builder->newObject(
'ParserData', array(
+ 'Title' => $parser->getTitle(),
+ 'ParserOutput' => $parser->getOutput()
+ ) );
+
+ $subobject = new Subobject( $parser->getTitle()
);
+
+ $messageFormatter = $builder->newObject(
'MessageFormatter', array(
+ 'Language' =>
$parser->getTargetLanguage()
+ ) );
+
+ $instance = new SubobjectParserFunction(
$parserData, $subobject, $messageFormatter );
+
+ return $instance;
+ },
+
+ /**
* FunctionHookRegistry object definition
*
* @since 1.9
diff --git a/includes/parserhooks/ParserFunctionFactory.php
b/includes/parserhooks/ParserFunctionFactory.php
index d2a1bc4..7eb562d 100644
--- a/includes/parserhooks/ParserFunctionFactory.php
+++ b/includes/parserhooks/ParserFunctionFactory.php
@@ -7,31 +7,32 @@
/**
* Factory class for convenience parser function instantiation
*
- * @file
+ * @see http://www.semantic-mediawiki.org/wiki/Help:ParserFunction
*
- * @license GNU GPL v2+
- * @since 1.9
+ * @ingroup ParserFunction
+ *
+ * @licence GNU GPL v2+
+ * @since 1.9
*
* @author mwjames
*/
-
-/**
- * Factory class for convenience parser function instantiation
- *
- * @ingroup ParserFunction
- */
-class ParserFunctionFactory {
+class ParserFunctionFactory implements ContextAware {
/** @var Parser */
protected $parser;
+
+ /** @var ContextResource */
+ protected $context = null;
/**
* @since 1.9
*
* @param Parser $parser
+ * @param ContextResource|null $context
*/
- public function __construct( Parser $parser ) {
+ public function __construct( Parser $parser, ContextResource $context =
null ) {
$this->parser = $parser;
+ $this->context = $context;
}
/**
@@ -48,6 +49,22 @@
}
/**
+ * @see ContextAware::withContext
+ *
+ * @since 1.9
+ *
+ * @return ContextResource
+ */
+ public function withContext() {
+
+ if ( $this->context === null ) {
+ $this->context = new BaseContext();
+ }
+
+ return $this->context;
+ }
+
+ /**
* Convenience instantiation of a SubobjectParserFunction object
*
* @since 1.9
@@ -55,11 +72,7 @@
* @return SubobjectParserFunction
*/
public function getSubobjectParser() {
- return new SubobjectParserFunction(
- new ParserData( $this->parser->getTitle(),
$this->parser->getOutput() ),
- new Subobject( $this->parser->getTitle() ),
- new MessageFormatter(
$this->parser->getTargetLanguage() )
- );
+ return $this->withContext()->getDependencyBuilder()->newObject(
'SubobjectParserFunction', array( 'Parser' => $this->parser ) );
}
/**
diff --git a/includes/parserhooks/SubobjectParserFunction.php
b/includes/parserhooks/SubobjectParserFunction.php
index 231f9fc..2b46882 100644
--- a/includes/parserhooks/SubobjectParserFunction.php
+++ b/includes/parserhooks/SubobjectParserFunction.php
@@ -5,22 +5,16 @@
use Parser;
/**
- * Class that provides the {{#subobject}} parser function
+ * Provides the {{#subobject}} parser function
*
- * @see http://www.semantic-mediawiki.org/wiki/Help:Subobject
- *
- * @file
- *
- * @license GNU GPL v2+
- * @since 1.9
- *
- * @author mwjames
- */
-
-/**
- * Class that provides the {{#subobject}} parser function
+ * @see http://www.semantic-mediawiki.org/wiki/Help:ParserFunction
*
* @ingroup ParserFunction
+ *
+ * @licence GNU GPL v2+
+ * @since 1.9
+ *
+ * @author mwjames
*/
class SubobjectParserFunction {
@@ -47,17 +41,6 @@
$this->parserData = $parserData;
$this->subobject = $subobject;
$this->msgFormatter = $msgFormatter;
- }
-
- /**
- * Returns invoked subobject
- *
- * @since 1.9
- *
- * @return Subobject
- */
- public function getSubobject() {
- return $this->subobject;
}
/**
@@ -158,20 +141,4 @@
->getHtml();
}
- /**
- * Parser::setFunctionHook {{#subobject}} handler method
- *
- * @param Parser $parser
- *
- * @return string|null
- */
- public static function render( Parser &$parser ) {
- $instance = new self(
- new ParserData( $parser->getTitle(),
$parser->getOutput() ),
- new Subobject( $parser->getTitle() ),
- new MessageFormatter( $parser->getTargetLanguage() )
- );
-
- return $instance->parse(
ParameterFormatterFactory::newFromArray( func_get_args() ) );
- }
}
diff --git a/tests/phpunit/includes/SubobjectTest.php
b/tests/phpunit/includes/SubobjectTest.php
index b5d3154..d85498b 100644
--- a/tests/phpunit/includes/SubobjectTest.php
+++ b/tests/phpunit/includes/SubobjectTest.php
@@ -11,29 +11,21 @@
use Title;
/**
- * Tests for the Subobject class
- *
- * @file
- *
- * @license GNU GPL v2+
- * @since 1.9
- *
- * @author mwjames
- */
-
-/**
* @covers \SMW\Subobject
*
* @ingroup Test
*
* @group SMW
* @group SMWExtension
+ *
+ * @licence GNU GPL v2+
+ * @since 1.9
+ *
+ * @author mwjames
*/
class SubobjectTest extends ParserTestCase {
/**
- * Returns the name of the class to be tested
- *
* @return string|false
*/
public function getClass() {
@@ -41,26 +33,16 @@
}
/**
- * Helper method that returns a DataValue object
- *
* @since 1.9
- *
- * @param $propertyName
- * @param $value
*
* @return SMWDataValue
*/
- private function getDataValue( $propertyName, $value ){
+ private function newDataValue( $propertyName, $value ){
return DataValueFactory::newPropertyValue( $propertyName,
$value );
}
/**
- * Helper method that returns a Subobject object
- *
* @since 1.9
- *
- * @param $title
- * @param $id
*
* @return Subobject
*/
@@ -81,8 +63,6 @@
}
/**
- * @test Subobject::__construct
- *
* @since 1.9
*/
public function testConstructor() {
@@ -90,53 +70,55 @@
}
/**
- * @test Subobject::newFromId
- *
* @since 1.9
*/
- public function testNewFromId() {
+ public function testSetSemanticDataInvalidArgumentException() {
- $id = 'Foo';
- $instance = Subobject::newFromId( $this->getTitle(), $id );
+ $this->setExpectedException( 'InvalidArgumentException' );
- $this->assertInstanceOf( $this->getClass(), $instance );
- $this->assertEquals( $id, $instance->getId() );
+ $instance = new Subobject( $this->newTitle() );
+ $instance->setSemanticData( '' );
}
/**
- * @test Subobject::setSemanticData
- *
* @since 1.9
*/
public function testSetSemanticData() {
- $instance = $this->newInstance( $this->getTitle() );
+ $instance = $this->newInstance( $this->newTitle() );
+
+ $instance->setSemanticData( 'Foo' );
+
+ $this->assertInstanceOf(
+ '\Title',
+ $instance->getTitle()
+ );
$this->assertInstanceOf(
'\SMWContainerSemanticData',
- $instance->setSemanticData( $this->newRandomString() )
+ $instance->getSemanticData()
);
- $this->assertEmpty( $instance->setSemanticData( '' ) );
+
+ $this->assertEquals(
+ 'Foo',
+
$instance->getSemanticData()->getSubject()->getSubobjectname(),
+ 'Asserts that getSubobjectname() returns with an
expected result'
+ );
}
/**
- * @test Subobject::getId
* @dataProvider getDataProvider
*
* @note For an anonymous identifier we only use the first character
* as comparison
*
* @since 1.9
- *
- * @param array $test
- * @param array $expected
- * @param array $info
*/
public function testGetId( array $test, array $expected, array $info ) {
- $subobject = $this->newInstance( $this->getTitle(),
$test['identifier'] );
+ $subobject = $this->newInstance( $this->newTitle(),
$test['identifier'] );
$id = $expected['identifier'] === '_' ? substr(
$subobject->getId(), 0, 1 ) : $subobject->getId();
$this->assertEquals( $expected['identifier'], $id, $info['msg']
);
@@ -144,37 +126,29 @@
}
/**
- * @test Subobject::getProperty
* @dataProvider getDataProvider
*
* @since 1.9
- *
- * @param array $test
*/
public function testGetProperty( array $test ) {
- $subobject = $this->newInstance( $this->getTitle(),
$test['identifier'] );
+ $subobject = $this->newInstance( $this->newTitle(),
$test['identifier'] );
$this->assertInstanceOf( '\SMW\DIProperty',
$subobject->getProperty() );
}
/**
- * @test Subobject::addDataValue
* @dataProvider getDataProvider
*
* @since 1.9
- *
- * @param array $test
- * @param array $expected
- * @param array $info
*/
public function testaddDataValue( array $test, array $expected, array
$info ) {
- $subobject = $this->newInstance( $this->getTitle(),
$test['identifier'] );
+ $subobject = $this->newInstance( $this->newTitle(),
$test['identifier'] );
foreach ( $test['properties'] as $property => $value ){
$subobject->addDataValue(
- $this->getDataValue( $property, $value )
+ $this->newDataValue( $property, $value )
);
}
@@ -185,13 +159,9 @@
}
/**
- * @test Subobject::addDataValue
- * @dataProvider getDataValueProvider
+ * @dataProvider newDataValueProvider
*
* @since 1.9
- *
- * @param array $test
- * @param array $expected
*/
public function testDataValueExaminer( array $test, array $expected ) {
@@ -208,7 +178,7 @@
'isValid' => true,
) );
- $subobject = $this->newInstance( $this->getTitle(),
$this->newRandomString() );
+ $subobject = $this->newInstance( $this->newTitle(),
$this->newRandomString() );
$subobject->addDataValue( $dataValue );
$this->assertCount( $expected['errors'],
$subobject->getErrors() );
@@ -218,8 +188,6 @@
}
/**
- * @test Subobject::addDataValue
- *
* @since 1.9
*
* @throws InvalidSemanticDataException
@@ -228,24 +196,19 @@
$this->setExpectedException(
'\SMW\InvalidSemanticDataException' );
- $subobject = new Subobject( $this->getTitle() );
- $subobject->addDataValue( $this->getDataValue( 'Foo', 'Bar' ) );
+ $subobject = new Subobject( $this->newTitle() );
+ $subobject->addDataValue( $this->newDataValue( 'Foo', 'Bar' ) );
}
/**
- * @test Subobject::generateId
* @dataProvider getDataProvider
*
* @since 1.9
- *
- * @param array $test
- * @param array $expected
- * @param array $info
*/
public function testGenerateId( array $test, array $expected, array
$info ) {
- $subobject = $this->newInstance( $this->getTitle() );
+ $subobject = $this->newInstance( $this->newTitle() );
$this->assertEquals(
'_',
substr( $subobject->generateId( new HashIdGenerator(
$test['identifier'], '_' ) ), 0, 1 ),
@@ -255,26 +218,18 @@
}
/**
- * @test Subobject::getContainer
* @dataProvider getDataProvider
*
* @since 1.9
- *
- * @param array $test
- * @param array $expected
- * @param array $info
*/
public function testGetContainer( array $test, array $expected, array
$info ) {
- $subobject = $this->newInstance( $this->getTitle(),
$test['identifier'] );
+ $subobject = $this->newInstance( $this->newTitle(),
$test['identifier'] );
$this->assertInstanceOf( '\SMWDIContainer',
$subobject->getContainer(), $info['msg'] );
}
/**
- * Provides sample data of combinations used in connection with a
- * Subobject instance
- *
* @return array
*/
public function getDataProvider() {
@@ -400,7 +355,7 @@
*
* @return array
*/
- public function getDataValueProvider() {
+ public function newDataValueProvider() {
return array(
diff --git a/tests/phpunit/includes/dic/SharedDependencyContainerTest.php
b/tests/phpunit/includes/dic/SharedDependencyContainerTest.php
index 3f5c845..6870854 100644
--- a/tests/phpunit/includes/dic/SharedDependencyContainerTest.php
+++ b/tests/phpunit/includes/dic/SharedDependencyContainerTest.php
@@ -200,6 +200,12 @@
)
);
+ $provider[] = array( 'SubobjectParserFunction', array(
'\SMW\SubobjectParserFunction' => array(
+ 'Parser' => $parser
+ )
+ )
+ );
+
return $provider;
}
}
diff --git a/tests/phpunit/includes/parserhooks/ParserFunctionFactoryTest.php
b/tests/phpunit/includes/parserhooks/ParserFunctionFactoryTest.php
index 0e7bcaf..5f06c90 100644
--- a/tests/phpunit/includes/parserhooks/ParserFunctionFactoryTest.php
+++ b/tests/phpunit/includes/parserhooks/ParserFunctionFactoryTest.php
@@ -5,29 +5,21 @@
use SMW\ParserFunctionFactory;
/**
- * Tests for the ParserFunctionFactory class
- *
- * @file
- *
- * @license GNU GPL v2+
- * @since 1.9
- *
- * @author mwjames
- */
-
-/**
* @covers \SMW\ParserFunctionFactory
*
* @ingroup Test
*
* @group SMW
* @group SMWExtension
+ *
+ * @licence GNU GPL v2+
+ * @since 1.9
+ *
+ * @author mwjames
*/
class ParserFunctionFactoryTest extends ParserTestCase {
/**
- * Returns the name of the class to be tested
- *
* @return string
*/
public function getClass() {
@@ -35,12 +27,7 @@
}
/**
- * Helper method that returns a ParserFunctionFactory object
- *
* @since 1.9
- *
- * @param Title $title
- * @param ParserOutput $parserOutput
*
* @return ParserFunctionFactory
*/
@@ -49,8 +36,6 @@
}
/**
- * @test ParserFunctionFactory::__construct
- *
* @since 1.9
*/
public function testConstructor() {
@@ -58,7 +43,6 @@
}
/**
- * @test ParserFunctionFactory::getRecurringEventsParser
* @dataProvider parserFunctionDataProvider
*
* @since 1.9
diff --git a/tests/phpunit/includes/parserhooks/SubobjectParserFunctionTest.php
b/tests/phpunit/includes/parserhooks/SubobjectParserFunctionTest.php
index e7825da..449eadd 100644
--- a/tests/phpunit/includes/parserhooks/SubobjectParserFunctionTest.php
+++ b/tests/phpunit/includes/parserhooks/SubobjectParserFunctionTest.php
@@ -13,29 +13,21 @@
use ParserOutput;
/**
- * Tests for the SubobjectParserFunction class
- *
- * @file
- *
- * @license GNU GPL v2+
- * @since 1.9
- *
- * @author mwjames
- */
-
-/**
* @covers \SMW\SubobjectParserFunction
*
* @ingroup Test
*
* @group SMW
* @group SMWExtension
+ *
+ * @licence GNU GPL v2+
+ * @since 1.9
+ *
+ * @author mwjames
*/
class SubobjectParserFunctionTest extends ParserTestCase {
/**
- * Returns the name of the class to be tested
- *
* @return string
*/
public function getClass() {
@@ -43,19 +35,14 @@
}
/**
- * Helper method that returns a SubobjectParserFunction object
- *
* @since 1.9
- *
- * @param $title
- * @param $parserOutput
*
* @return SubobjectParserFunction
*/
- private function newInstance( Title $title= null, ParserOutput
$parserOutput = null ) {
+ private function newInstance( Subobject $subobject = null, ParserOutput
$parserOutput = null ) {
- if ( $title === null ) {
- $title = $this->newTitle();
+ if ( $subobject === null ) {
+ $subobject = new Subobject( $this->newTitle() );
}
if ( $parserOutput === null ) {
@@ -63,15 +50,13 @@
}
return new SubobjectParserFunction(
- $this->newParserData( $title, $parserOutput ),
- new Subobject( $title ),
- new MessageFormatter( $title->getPageLanguage() )
+ $this->newParserData( $subobject->getTitle(),
$parserOutput ),
+ $subobject,
+ new MessageFormatter(
$subobject->getTitle()->getPageLanguage() )
);
}
/**
- * @test SubobjectParserFunction::__construct
- *
* @since 1.9
*/
public function testConstructor() {
@@ -79,17 +64,13 @@
}
/**
- * @test SubobjectParserFunction::parse
- * @dataProvider getSubobjectDataProvider
+ * @dataProvider parameterDataProvider
*
* @since 1.9
- *
- * @param array $params
- * @param array $expected
*/
public function testParse( array $params, array $expected ) {
- $instance = $this->newInstance( $this->newTitle(),
$this->newParserOutput() );
+ $instance = $this->newInstance();
$result = $instance->parse(
$this->getParserParameterFormatter( $params ) );
$this->assertEquals( $result !== '' , $expected['errors'] );
@@ -97,46 +78,40 @@
}
/**
- * @test SubobjectParserFunction::parse
- * @dataProvider getSubobjectDataProvider
+ * @dataProvider parameterDataProvider
*
* @since 1.9
- *
- * @param array $params
- * @param array $expected
*/
public function testInstantiatedSubobject( array $params, array
$expected ) {
- $instance = $this->newInstance( $this->newTitle(),
$this->newParserOutput() );
+ $subobject = new Subobject( $this->newTitle() );
+
+ $instance = $this->newInstance( $subobject );
$instance->parse( $this->getParserParameterFormatter( $params )
);
- $this->assertContains( $expected['identifier'],
$instance->getSubobject()->getId() );
+ $this->assertContains( $expected['identifier'],
$subobject->getId() );
}
/**
- * @test SubobjectParserFunction::parse
* @dataProvider getObjectReferenceDataProvider
*
* @since 1.9
- *
- * @param boolean $isEnabled
- * @param array $params
- * @param array $expected
*/
public function testObjectReference( $isEnabled, array $params, array
$expected, array $info ) {
$parserOutput = $this->newParserOutput();
$title = $this->newTitle();
+ $subobject = new Subobject( $title );
// Initialize and parse
- $instance = $this->newInstance( $title, $parserOutput );
+ $instance = $this->newInstance( $subobject, $parserOutput );
$instance->setObjectReference( $isEnabled );
$instance->parse( $this->getParserParameterFormatter( $params )
);
// If it is enabled only check for the first character {0} that
should
// contain '_' as the rest is going to be an unknown hash value
- $id = $instance->getSubobject()->getId();
+ $id = $subobject->getId();
$this->assertEquals( $expected['identifier'], $isEnabled ?
$id{0} : $id, $info['msg'] );
// Get data instance
@@ -153,29 +128,23 @@
}
/**
- * Test instantiated property and value strings
- *
- * @test SubobjectParserFunction::parse
- * @dataProvider getSubobjectDataProvider
+ * @dataProvider parameterDataProvider
*
* @since 1.9
- *
- * @param array $params
- * @param array $expected
*/
public function testInstantiatedPropertyValues( array $params, array
$expected ) {
$parserOutput = $this->newParserOutput();
$title = $this->newTitle();
+ $subobject = new Subobject( $title );
// Initialize and parse
- $instance = $this->newInstance( $title, $parserOutput );
+ $instance = $this->newInstance( $subobject, $parserOutput );
$instance->parse( $this->getParserParameterFormatter( $params )
);
// Get semantic data from the ParserOutput
$parserData = $this->newParserData( $title, $parserOutput );
- // Check the returned instance
$this->assertInstanceOf( '\SMW\SemanticData',
$parserData->getData() );
// Confirm subSemanticData objects for the SemanticData instance
@@ -186,27 +155,9 @@
}
/**
- * @test SubobjectParserFunction::render
- *
- * @since 1.9
- */
- public function testStaticRender() {
-
- $parser = $this->newParser( $this->newTitle(), $this->getUser()
);
- $result = SubobjectParserFunction::render( $parser );
-
- $this->assertInternalType( 'string', $result );
- }
-
- /**
- * Provides data sample normally found in connection with the
{{#subobject}}
- * parser function. The first array contains parametrized input value
while
- * the second array contains expected return results for the
instantiated
- * object.
- *
* @return array
*/
- public function getSubobjectDataProvider() {
+ public function parameterDataProvider() {
// Get the right language for an error object
$diPropertyError = new SMWDIProperty( SMWDIProperty::TYPE_ERROR
);
--
To view, visit https://gerrit.wikimedia.org/r/90713
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8a9cdf3187c8e532d84665e2cd8a80dcd2886238
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