Mwjames has uploaded a new change for review. https://gerrit.wikimedia.org/r/82797
Change subject: Rename addPropertyValue -> addDataValue ...................................................................... Rename addPropertyValue -> addDataValue Follow-up on [1] [1] https://gerrit.wikimedia.org/r/#/c/75295/ Change-Id: I89439ca9157b919346bf7e1660899bb399b45702 --- M includes/ParserData.php M includes/ParserTextProcessor.php M includes/Subobject.php M includes/parserhooks/SetParserFunction.php M includes/parserhooks/SubobjectParserFunction.php M tests/phpunit/includes/ParserDataTest.php M tests/phpunit/includes/SemanticDataTest.php M tests/phpunit/includes/SubobjectTest.php 8 files changed, 32 insertions(+), 40 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMediaWiki refs/changes/97/82797/1 diff --git a/includes/ParserData.php b/includes/ParserData.php index 3f82fda..0cd5755 100644 --- a/includes/ParserData.php +++ b/includes/ParserData.php @@ -97,14 +97,6 @@ * Class that provides access to the semantic data object generated from either * the ParserOuput or subject provided (no static binding as in SMWParseData) * - * The responsibility of this class is to handle mainly the parserOutput object, - * and one could argue that addPropertyValueString() has to be removed, while - * addCategories(), addDefaultSort(), addSpecialProperties() are manipulating - * the semantic data container invoked from the parserOutput object. - * - * UpdateStore(), getDiffPropertyTypes(), getDiffConversionFactors() are - * responsible to update the store with the processed semantic data container. - * * @ingroup SMW * @ingroup ParserHooks * @@ -327,16 +319,16 @@ * @par Example: * @code * $dataValue = DataValueFactory::newPropertyValue( $userProperty, $userValue ) - * $parserData->addPropertyValue( $dataValue ) + * $parserData->addDataValue( $dataValue ) * @endcode * * @since 1.9 * * @param SMWDataValue $dataValue */ - public function addPropertyValue( SMWDataValue $dataValue ) { + public function addDataValue( SMWDataValue $dataValue ) { - // FIXME Remove the addPropertyValue method from + // FIXME Remove the addDataValue method from // the ParserData object $this->semanticData->addDataValue( $dataValue ); $this->addError( $this->semanticData->getErrors() ); diff --git a/includes/ParserTextProcessor.php b/includes/ParserTextProcessor.php index cc06adc..1ba0435 100644 --- a/includes/ParserTextProcessor.php +++ b/includes/ParserTextProcessor.php @@ -282,7 +282,7 @@ ); if ( $this->isEnabled && $this->isAnnotation ) { - $this->parserData->addPropertyValue( $dataValue ); + $this->parserData->addDataValue( $dataValue ); } } diff --git a/includes/Subobject.php b/includes/Subobject.php index fe4561f..21090e9 100644 --- a/includes/Subobject.php +++ b/includes/Subobject.php @@ -54,7 +54,7 @@ * @par Example: * @code * $subobject = Subobject::newFromId( 'Foo', 'Bar' ); - * $subobject->addPropertyValue( $dataValue ) + * $subobject->addDataValue( $dataValue ) * @endcode * * @since 1.9 @@ -183,7 +183,7 @@ * @code * $dataValue = DataValueFactory::newPropertyValue( $userProperty, $userValue ) * - * Subobject::newFromId( 'Foo', 'Bar' )->addPropertyValue( $dataValue ) + * Subobject::newFromId( 'Foo', 'Bar' )->addDataValue( $dataValue ) * @endcode * * @since 1.9 @@ -192,7 +192,7 @@ * * @throws InvalidSemanticDataException */ - public function addPropertyValue( SMWDataValue $dataValue ) { + public function addDataValue( SMWDataValue $dataValue ) { if ( !( $this->semanticData instanceof SMWContainerSemanticData ) ) { throw new InvalidSemanticDataException( 'The semantic data container is not initialized' ); diff --git a/includes/parserhooks/SetParserFunction.php b/includes/parserhooks/SetParserFunction.php index f0b47f0..8971d9e 100644 --- a/includes/parserhooks/SetParserFunction.php +++ b/includes/parserhooks/SetParserFunction.php @@ -58,7 +58,7 @@ // Add dataValues foreach ( $parameters->toArray() as $property => $values ){ foreach ( $values as $value ) { - $this->parserData->addPropertyValue( + $this->parserData->addDataValue( DataValueFactory::newPropertyValue( $property, $value diff --git a/includes/parserhooks/SubobjectParserFunction.php b/includes/parserhooks/SubobjectParserFunction.php index e485af6..5ebb74d 100644 --- a/includes/parserhooks/SubobjectParserFunction.php +++ b/includes/parserhooks/SubobjectParserFunction.php @@ -122,7 +122,7 @@ // Add property / values to the subobject instance foreach ( $parameters->toArray() as $property => $values ){ foreach ( $values as $value ) { - $this->subobject->addPropertyValue( + $this->subobject->addDataValue( DataValueFactory::newPropertyValue( $property, $value ) ); } diff --git a/tests/phpunit/includes/ParserDataTest.php b/tests/phpunit/includes/ParserDataTest.php index be4cfa2..91af71d 100644 --- a/tests/phpunit/includes/ParserDataTest.php +++ b/tests/phpunit/includes/ParserDataTest.php @@ -101,7 +101,7 @@ ); // Values - $instance->addPropertyValue( + $instance->addDataValue( DataValueFactory::newPropertyValue( $propertyName, $value diff --git a/tests/phpunit/includes/SemanticDataTest.php b/tests/phpunit/includes/SemanticDataTest.php index dab38d9..83c7238 100644 --- a/tests/phpunit/includes/SemanticDataTest.php +++ b/tests/phpunit/includes/SemanticDataTest.php @@ -42,7 +42,7 @@ * * @return SemanticData */ - private function getInstance() { + private function newInstance() { return new SemanticData( $this->newSubject() ); } @@ -52,12 +52,12 @@ * @since 1.9 */ public function testConstructor() { - $this->assertInstanceOf( $this->getClass(), $this->getInstance() ); - $this->assertInstanceOf( 'SMWSemanticData', $this->getInstance() ); + $this->assertInstanceOf( $this->getClass(), $this->newInstance() ); + $this->assertInstanceOf( 'SMWSemanticData', $this->newInstance() ); } /** - * @test SemanticData::addPropertyValue + * @test SemanticData::addDataValue * @dataProvider dataValueDataProvider * * @since 1.9 @@ -67,7 +67,7 @@ */ public function testAddDataValue( $dataValues, $expected ) { - $instance = $this->getInstance(); + $instance = $this->newInstance(); foreach ( $dataValues as $dataValue ) { $instance->addDataValue( $dataValue ); diff --git a/tests/phpunit/includes/SubobjectTest.php b/tests/phpunit/includes/SubobjectTest.php index a16fb56..41a4810 100644 --- a/tests/phpunit/includes/SubobjectTest.php +++ b/tests/phpunit/includes/SubobjectTest.php @@ -64,7 +64,7 @@ * * @return Subobject */ - private function getInstance( Title $title, $id = '' ) { + private function newInstance( Title $title, $id = '' ) { $instance = new Subobject( $title ); @@ -83,7 +83,7 @@ */ public function testConstructor() { - $instance = $this->getInstance( $this->getTitle() ); + $instance = $this->newInstance( $this->getTitle() ); $this->assertInstanceOf( $this->getClass(), $instance ); } @@ -110,7 +110,7 @@ */ public function testSetSemanticData() { - $instance = $this->getInstance( $this->getTitle() ); + $instance = $this->newInstance( $this->getTitle() ); $this->assertInstanceOf( '\SMWContainerSemanticData', @@ -135,7 +135,7 @@ */ public function testGetId( array $test, array $expected, array $info ) { - $subobject = $this->getInstance( $this->getTitle(), $test['identifier'] ); + $subobject = $this->newInstance( $this->getTitle(), $test['identifier'] ); $id = $expected['identifier'] === '_' ? substr( $subobject->getId(), 0, 1 ) : $subobject->getId(); $this->assertEquals( $expected['identifier'], $id, $info['msg'] ); @@ -152,13 +152,13 @@ */ public function testGetProperty( array $test ) { - $subobject = $this->getInstance( $this->getTitle(), $test['identifier'] ); + $subobject = $this->newInstance( $this->getTitle(), $test['identifier'] ); $this->assertInstanceOf( '\SMW\DIProperty', $subobject->getProperty() ); } /** - * @test Subobject::addPropertyValue + * @test Subobject::addDataValue * @dataProvider getDataProvider * * @since 1.9 @@ -167,12 +167,12 @@ * @param array $expected * @param array $info */ - public function testAddPropertyValue( array $test, array $expected, array $info ) { + public function testaddDataValue( array $test, array $expected, array $info ) { - $subobject = $this->getInstance( $this->getTitle(), $test['identifier'] ); + $subobject = $this->newInstance( $this->getTitle(), $test['identifier'] ); foreach ( $test['properties'] as $property => $value ){ - $subobject->addPropertyValue( + $subobject->addDataValue( $this->getDataValue( $property, $value ) ); } @@ -184,7 +184,7 @@ } /** - * @test Subobject::addPropertyValue + * @test Subobject::addDataValue * @dataProvider getDataValueProvider * * @since 1.9 @@ -207,8 +207,8 @@ 'isValid' => true, ) )->getMockDataValue(); - $subobject = $this->getInstance( $this->getTitle(), $this->getRandomString() ); - $subobject->addPropertyValue( $dataValue ); + $subobject = $this->newInstance( $this->getTitle(), $this->getRandomString() ); + $subobject->addDataValue( $dataValue ); $this->assertCount( $expected['errors'], $subobject->getErrors() ); $this->assertInstanceOf( '\SMW\SemanticData', $subobject->getSemanticData() ); @@ -217,18 +217,18 @@ } /** - * @test Subobject::addPropertyValue + * @test Subobject::addDataValue * * @since 1.9 * * @throws InvalidSemanticDataException */ - public function testAddPropertyValueStringException() { + public function testAddDataValueStringException() { $this->setExpectedException( '\SMW\InvalidSemanticDataException' ); $subobject = new Subobject( $this->getTitle() ); - $subobject->addPropertyValue( $this->getDataValue( 'Foo', 'Bar' ) ); + $subobject->addDataValue( $this->getDataValue( 'Foo', 'Bar' ) ); } @@ -244,7 +244,7 @@ */ public function testGenerateId( array $test, array $expected, array $info ) { - $subobject = $this->getInstance( $this->getTitle() ); + $subobject = $this->newInstance( $this->getTitle() ); $this->assertEquals( '_', substr( $subobject->generateId( new HashIdGenerator( $test['identifier'], '_' ) ), 0, 1 ), @@ -265,7 +265,7 @@ */ public function testGetContainer( array $test, array $expected, array $info ) { - $subobject = $this->getInstance( $this->getTitle(), $test['identifier'] ); + $subobject = $this->newInstance( $this->getTitle(), $test['identifier'] ); $this->assertInstanceOf( '\SMWDIContainer', $subobject->getContainer(), $info['msg'] ); } -- To view, visit https://gerrit.wikimedia.org/r/82797 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I89439ca9157b919346bf7e1660899bb399b45702 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
