Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/68402
Change subject: Removed dead test and inlined deprecated method ...................................................................... Removed dead test and inlined deprecated method With this change, the DataModel tests now run without loading wikibase lib and repo Change-Id: If00aa6ecb2e9d74116a9f5d1b2b8b5eb734ee17d --- M DataModel/DataModel/Entity/Property.php M DataModel/phpunit.xml.dist M DataModel/tests/phpunit/Entity/PropertyTest.php M repo/includes/api/SetClaimValue.php 4 files changed, 5 insertions(+), 71 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/02/68402/1 diff --git a/DataModel/DataModel/Entity/Property.php b/DataModel/DataModel/Entity/Property.php index d2f66dc..64bfe9c 100644 --- a/DataModel/DataModel/Entity/Property.php +++ b/DataModel/DataModel/Entity/Property.php @@ -160,18 +160,4 @@ return self::newFromArray( array( 'datatype' => $dataTypeId ) ); } - /** - * Factory for creating new DataValue objects for the property. - * - * @since 0.3 - * @deprecated since 0.4 - * - * @param mixed $rawDataValue - * - * @return DataValue - */ - public function newDataValue( $rawDataValue ) { - return \DataValues\DataValueFactory::singleton()->newDataValue( $this->getDataType()->getDataValueType(), $rawDataValue ); - } - } diff --git a/DataModel/phpunit.xml.dist b/DataModel/phpunit.xml.dist index 7c33f91..31d5779 100644 --- a/DataModel/phpunit.xml.dist +++ b/DataModel/phpunit.xml.dist @@ -16,7 +16,7 @@ <testsuite name="WikibaseDataModelWithoutMW"> <directory>tests/phpunit</directory> - <exclude>tests/phpunit/Entity/PropertyTest.php</exclude> + </testsuite> <testsuite name="WikibaseDataModelAll"> <directory>tests/phpunit</directory> diff --git a/DataModel/tests/phpunit/Entity/PropertyTest.php b/DataModel/tests/phpunit/Entity/PropertyTest.php index 0993b24..f0437b4 100644 --- a/DataModel/tests/phpunit/Entity/PropertyTest.php +++ b/DataModel/tests/phpunit/Entity/PropertyTest.php @@ -66,61 +66,6 @@ return Property::newFromArray( $data ); } - public function propertyProvider() { - $objects = array(); - - $objects[] = Property::newEmpty(); - - $entity = Property::newEmpty(); - $entity->setDescription( 'en', 'foo' ); - $objects[] = $entity; - - $entity = Property::newEmpty(); - $entity->setDescription( 'en', 'foo' ); - $entity->setDescription( 'de', 'foo' ); - $entity->setLabel( 'en', 'foo' ); - $entity->setAliases( 'de', array( 'bar', 'baz' ) ); - $objects[] = $entity; - - $entity = $entity->copy(); - $entity->addClaim( new Claim( new PropertyNoValueSnak( - new EntityId( Property::ENTITY_TYPE, 42 ) - ) ) ); - $objects[] = $entity; - - return $this->arrayWrap( $objects ); - } - - public function newDataValueProvider() { - $argLists = array(); - - $property = Property::newFromType( 'wikibase-item' ); - $property->setId( 852645 ); - - $argLists[] = array( clone $property, new EntityId( Item::ENTITY_TYPE, 42 ) ); - $argLists[] = array( clone $property, new EntityId( Item::ENTITY_TYPE, 9001 ) ); - - $property->setId( 852642 ); - - $argLists[] = array( clone $property, new EntityId( Item::ENTITY_TYPE, 9001 ) ); - - $property->setDataTypeId( 'commonsMedia' ); - - return $argLists; - } - - /** - * @dataProvider newDataValueProvider - * - * @param Property $property - * @param \DataValues\DataValue $dataValue - */ - public function testNewDataValue( Property $property, \DataValues\DataValue $dataValue ) { - $newDataValue = $property->newDataValue( $dataValue->getArrayValue() ); - - $this->assertTrue( $dataValue->equals( $newDataValue ) ); - } - public function testNewFromType() { $property = Property::newFromType( 'string' ); $this->assertInstanceOf( 'Wikibase\Property', $property ); diff --git a/repo/includes/api/SetClaimValue.php b/repo/includes/api/SetClaimValue.php index d8aba33..d8abca6 100644 --- a/repo/includes/api/SetClaimValue.php +++ b/repo/includes/api/SetClaimValue.php @@ -140,7 +140,10 @@ ); } - $constructorArguments[] = $content->getProperty()->newDataValue( $value ); + $constructorArguments[] = \DataValues\DataValueFactory::singleton()->newDataValue( + $content->getProperty()->getDataType()->getDataValueType(), + $value + ); } $claim->setMainSnak( SnakObject::newFromType( $snakType, $constructorArguments ) ); -- To view, visit https://gerrit.wikimedia.org/r/68402 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If00aa6ecb2e9d74116a9f5d1b2b8b5eb734ee17d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits