[MediaWiki-commits] [Gerrit] Use Property-setDataTypeId rather then -setDataType so no ... - change (mediawiki...Wikibase)
Daniel Kinzler has submitted this change and it was merged. Change subject: Use Property-setDataTypeId rather then -setDataType so no DataType construction is needed .. Use Property-setDataTypeId rather then -setDataType so no DataType construction is needed This gets rid of LibRegistry usage as well Change-Id: I07e334767054310f1a725e43c304db8c91ec6ca0 --- M repo/maintenance/importProperties.php M repo/tests/phpunit/includes/api/GetClaimsTest.php M repo/tests/phpunit/includes/api/RemoveClaimsTest.php M repo/tests/phpunit/includes/api/SetClaimValueTest.php M repo/tests/phpunit/includes/content/PropertyContentTest.php 5 files changed, 7 insertions(+), 25 deletions(-) Approvals: Daniel Kinzler: Verified; Looks good to me, approved jenkins-bot: Checked diff --git a/repo/maintenance/importProperties.php b/repo/maintenance/importProperties.php index 85f86f4..bbe547f 100644 --- a/repo/maintenance/importProperties.php +++ b/repo/maintenance/importProperties.php @@ -121,9 +121,7 @@ foreach ( $data as $lang = $title ) { $label = $title; $property-setLabel( $lang, $label ); - - $libRegistry = new \Wikibase\LibRegistry( \Wikibase\Settings::singleton() ); -$property-setDataType( $libRegistry-getDataTypeFactory()-getType( 'wikibase-item' ) ); +$property-setDataTypeId( 'wikibase-item' ); } $content = \Wikibase\PropertyContent::newFromProperty( $property ); diff --git a/repo/tests/phpunit/includes/api/GetClaimsTest.php b/repo/tests/phpunit/includes/api/GetClaimsTest.php index 0c2e558..602daff 100644 --- a/repo/tests/phpunit/includes/api/GetClaimsTest.php +++ b/repo/tests/phpunit/includes/api/GetClaimsTest.php @@ -68,9 +68,7 @@ protected function getNewEntities() { $property = \Wikibase\Property::newEmpty(); - $libRegistry = new \Wikibase\LibRegistry( \Wikibase\Settings::singleton() ); - $dataTypes = $libRegistry-getDataTypeFactory()-getTypes(); - $property-setDataType( reset( $dataTypes ) ); + $property-setDataTypeId( 'string' ); return array( $this-addClaimsAndSave( \Wikibase\Item::newEmpty() ), diff --git a/repo/tests/phpunit/includes/api/RemoveClaimsTest.php b/repo/tests/phpunit/includes/api/RemoveClaimsTest.php index 7e88acf..105d4c6 100644 --- a/repo/tests/phpunit/includes/api/RemoveClaimsTest.php +++ b/repo/tests/phpunit/includes/api/RemoveClaimsTest.php @@ -62,11 +62,7 @@ public function entityProvider() { $property = \Wikibase\Property::newEmpty(); - - $libRegistry = new \Wikibase\LibRegistry( \Wikibase\Settings::singleton() ); - $dataTypes = $libRegistry-getDataTypeFactory()-getTypes(); - - $property-setDataType( reset( $dataTypes ) ); + $property-setDataTypeId( 'string' ); return array( $this-addClaimsAndSave( \Wikibase\Item::newEmpty() ), diff --git a/repo/tests/phpunit/includes/api/SetClaimValueTest.php b/repo/tests/phpunit/includes/api/SetClaimValueTest.php index 2520708..0ed51d8 100644 --- a/repo/tests/phpunit/includes/api/SetClaimValueTest.php +++ b/repo/tests/phpunit/includes/api/SetClaimValueTest.php @@ -66,11 +66,7 @@ */ protected function getEntities( EntityId $propertyId ) { $property = \Wikibase\Property::newEmpty(); - - $libRegistry = new \Wikibase\LibRegistry( \Wikibase\Settings::singleton() ); - $dataTypes = $libRegistry-getDataTypeFactory()-getTypes(); - - $property-setDataType( reset( $dataTypes ) ); + $property-setDataTypeId( 'string' ); return array( $this-addClaimsAndSave( \Wikibase\Item::newEmpty(), $propertyId ), diff --git a/repo/tests/phpunit/includes/content/PropertyContentTest.php b/repo/tests/phpunit/includes/content/PropertyContentTest.php index ba7e599..d709458 100644 --- a/repo/tests/phpunit/includes/content/PropertyContentTest.php +++ b/repo/tests/phpunit/includes/content/PropertyContentTest.php @@ -59,10 +59,7 @@ */ protected function newEmpty() { $content = PropertyContent::newEmpty(); - - $libRegistry = new \Wikibase\LibRegistry( \Wikibase\Settings::singleton() ); - $dataTypes = $libRegistry-getDataTypeFactory()-getTypes(); - $content-getProperty()-setDataType( array_shift( $dataTypes ) ); + $content-getProperty()-setDataTypeId( 'string' ); return $content; } @@ -70,20 +67,17 @@ public function testLabelUniquenessRestriction() { \Wikibase\StoreFactory::getStore()-getTermIndex()-clear(); - $libRegistry = new \Wikibase\LibRegistry(
[MediaWiki-commits] [Gerrit] Use Property-setDataTypeId rather then -setDataType so no ... - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/60217 Change subject: Use Property-setDataTypeId rather then -setDataType so no DataType construction is needed .. Use Property-setDataTypeId rather then -setDataType so no DataType construction is needed This gets rid of LibRegistry usage as well Change-Id: I07e334767054310f1a725e43c304db8c91ec6ca0 --- M repo/maintenance/importProperties.php M repo/tests/phpunit/includes/api/GetClaimsTest.php M repo/tests/phpunit/includes/api/RemoveClaimsTest.php M repo/tests/phpunit/includes/api/SetClaimValueTest.php M repo/tests/phpunit/includes/content/PropertyContentTest.php 5 files changed, 7 insertions(+), 25 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/17/60217/1 diff --git a/repo/maintenance/importProperties.php b/repo/maintenance/importProperties.php index 85f86f4..bbe547f 100644 --- a/repo/maintenance/importProperties.php +++ b/repo/maintenance/importProperties.php @@ -121,9 +121,7 @@ foreach ( $data as $lang = $title ) { $label = $title; $property-setLabel( $lang, $label ); - - $libRegistry = new \Wikibase\LibRegistry( \Wikibase\Settings::singleton() ); -$property-setDataType( $libRegistry-getDataTypeFactory()-getType( 'wikibase-item' ) ); +$property-setDataTypeId( 'wikibase-item' ); } $content = \Wikibase\PropertyContent::newFromProperty( $property ); diff --git a/repo/tests/phpunit/includes/api/GetClaimsTest.php b/repo/tests/phpunit/includes/api/GetClaimsTest.php index 0c2e558..602daff 100644 --- a/repo/tests/phpunit/includes/api/GetClaimsTest.php +++ b/repo/tests/phpunit/includes/api/GetClaimsTest.php @@ -68,9 +68,7 @@ protected function getNewEntities() { $property = \Wikibase\Property::newEmpty(); - $libRegistry = new \Wikibase\LibRegistry( \Wikibase\Settings::singleton() ); - $dataTypes = $libRegistry-getDataTypeFactory()-getTypes(); - $property-setDataType( reset( $dataTypes ) ); + $property-setDataTypeId( 'string' ); return array( $this-addClaimsAndSave( \Wikibase\Item::newEmpty() ), diff --git a/repo/tests/phpunit/includes/api/RemoveClaimsTest.php b/repo/tests/phpunit/includes/api/RemoveClaimsTest.php index 7e88acf..105d4c6 100644 --- a/repo/tests/phpunit/includes/api/RemoveClaimsTest.php +++ b/repo/tests/phpunit/includes/api/RemoveClaimsTest.php @@ -62,11 +62,7 @@ public function entityProvider() { $property = \Wikibase\Property::newEmpty(); - - $libRegistry = new \Wikibase\LibRegistry( \Wikibase\Settings::singleton() ); - $dataTypes = $libRegistry-getDataTypeFactory()-getTypes(); - - $property-setDataType( reset( $dataTypes ) ); + $property-setDataTypeId( 'string' ); return array( $this-addClaimsAndSave( \Wikibase\Item::newEmpty() ), diff --git a/repo/tests/phpunit/includes/api/SetClaimValueTest.php b/repo/tests/phpunit/includes/api/SetClaimValueTest.php index 2520708..0ed51d8 100644 --- a/repo/tests/phpunit/includes/api/SetClaimValueTest.php +++ b/repo/tests/phpunit/includes/api/SetClaimValueTest.php @@ -66,11 +66,7 @@ */ protected function getEntities( EntityId $propertyId ) { $property = \Wikibase\Property::newEmpty(); - - $libRegistry = new \Wikibase\LibRegistry( \Wikibase\Settings::singleton() ); - $dataTypes = $libRegistry-getDataTypeFactory()-getTypes(); - - $property-setDataType( reset( $dataTypes ) ); + $property-setDataTypeId( 'string' ); return array( $this-addClaimsAndSave( \Wikibase\Item::newEmpty(), $propertyId ), diff --git a/repo/tests/phpunit/includes/content/PropertyContentTest.php b/repo/tests/phpunit/includes/content/PropertyContentTest.php index ba7e599..d709458 100644 --- a/repo/tests/phpunit/includes/content/PropertyContentTest.php +++ b/repo/tests/phpunit/includes/content/PropertyContentTest.php @@ -59,10 +59,7 @@ */ protected function newEmpty() { $content = PropertyContent::newEmpty(); - - $libRegistry = new \Wikibase\LibRegistry( \Wikibase\Settings::singleton() ); - $dataTypes = $libRegistry-getDataTypeFactory()-getTypes(); - $content-getProperty()-setDataType( array_shift( $dataTypes ) ); + $content-getProperty()-setDataTypeId( 'string' ); return $content; } @@ -70,20 +67,17 @@ public function testLabelUniquenessRestriction() { \Wikibase\StoreFactory::getStore()-getTermIndex()-clear(); -