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

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, 42 insertions(+), 51 deletions(-)

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



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..f4ffd80 100644
--- a/tests/phpunit/includes/ParserDataTest.php
+++ b/tests/phpunit/includes/ParserDataTest.php
@@ -49,7 +49,7 @@
         *
         * @return ParserData
         */
-       private function getInstance( Title $title, ParserOutput $parserOutput, 
array $settings = array() ) {
+       private function newInstance( Title $title, ParserOutput $parserOutput, 
array $settings = array() ) {
                return new ParserData(
                        $title,
                        $parserOutput,
@@ -63,7 +63,7 @@
         * @since 1.9
         */
        public function testConstructor() {
-               $instance = $this->getInstance(
+               $instance = $this->newInstance(
                        $this->newTitle(),
                        $this->newParserOutput()
                );
@@ -84,7 +84,7 @@
        }
 
        /**
-        * @test ParserData::addPropertyValue
+        * @test ParserData::addDataValue
         * @dataProvider getPropertyValueDataProvider
         *
         * @since 1.9
@@ -94,14 +94,14 @@
         * @param $errorCount
         * @param $propertyCount
         */
-       public function testAddPropertyValue( $propertyName, $value, 
$errorCount, $propertyCount ) {
-               $instance = $this->getInstance(
+       public function testAddDataValue( $propertyName, $value, $errorCount, 
$propertyCount ) {
+
+               $instance = $this->newInstance(
                        $this->getTitle(),
                        $this->getParserOutput()
                );
 
-               // Values
-               $instance->addPropertyValue(
+               $instance->addDataValue(
                        DataValueFactory::newPropertyValue(
                                $propertyName,
                                $value
@@ -131,7 +131,7 @@
                $title        = $this->newTitle();
                $parserOutput = $this->newParserOutput();
 
-               $instance = $this->getInstance( $title, $parserOutput );
+               $instance = $this->newInstance( $title, $parserOutput );
                $observer = new MockUpdateObserver();
 
                $instance->setObservableDispatcher( new 
ObservableSubjectDispatcher( $observer ) );
@@ -142,6 +142,5 @@
                $this->assertEquals( $notifier, $observer->getNotifier() );
 
        }
-
 
 }
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..e099c2c 100644
--- a/tests/phpunit/includes/SubobjectTest.php
+++ b/tests/phpunit/includes/SubobjectTest.php
@@ -64,12 +64,12 @@
         *
         * @return Subobject
         */
-       private function getInstance( Title $title, $id = '' ) {
+       private function newInstance( Title $title, $id = '' ) {
 
                $instance = new Subobject( $title );
 
                if ( $id === '' && $id !== null ) {
-                       $id = $instance->generateId( new HashIdGenerator( 
$this->getRandomString(), '_' ) );
+                       $id = $instance->generateId( new HashIdGenerator( 
$this->newRandomString(), '_' ) );
                }
 
                $instance->setSemanticData( $id );
@@ -83,7 +83,7 @@
         */
        public function testConstructor() {
 
-               $instance = $this->getInstance( $this->getTitle() );
+               $instance = $this->newInstance( $this->getTitle() );
                $this->assertInstanceOf( $this->getClass(), $instance );
 
        }
@@ -110,11 +110,11 @@
         */
        public function testSetSemanticData() {
 
-               $instance = $this->getInstance( $this->getTitle() );
+               $instance = $this->newInstance( $this->getTitle() );
 
                $this->assertInstanceOf(
                        '\SMWContainerSemanticData',
-                       $instance->setSemanticData( $this->getRandomString() )
+                       $instance->setSemanticData( $this->newRandomString() )
                );
                $this->assertEmpty( $instance->setSemanticData( '' ) );
 
@@ -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->newRandomString() );
+               $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,8 +265,8 @@
         */
        public function testGetContainer( array $test, array $expected, array 
$info  ) {
 
-               $subobject = $this->getInstance( $this->getTitle(), 
$test['identifier'] );
-               $this->assertInstanceOf( '\SMWDIContainer',     
$subobject->getContainer(), $info['msg'] );
+               $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: merged
Gerrit-Change-Id: I89439ca9157b919346bf7e1660899bb399b45702
Gerrit-PatchSet: 2
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