Jeroen De Dauw has uploaded a new change for review.
https://gerrit.wikimedia.org/r/208138
Change subject: Remove assumption that all entities have claims from
SetClaimValueTest
......................................................................
Remove assumption that all entities have claims from SetClaimValueTest
Change-Id: Ib90121e50a17b5198f818b48f44bd2b80641a6a6
---
M repo/tests/phpunit/includes/api/SetClaimValueTest.php
1 file changed, 11 insertions(+), 14 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/38/208138/1
diff --git a/repo/tests/phpunit/includes/api/SetClaimValueTest.php
b/repo/tests/phpunit/includes/api/SetClaimValueTest.php
index c42daa4..2b215d7 100644
--- a/repo/tests/phpunit/includes/api/SetClaimValueTest.php
+++ b/repo/tests/phpunit/includes/api/SetClaimValueTest.php
@@ -13,12 +13,12 @@
use Wikibase\DataModel\Claim\Claim;
use Wikibase\DataModel\Claim\Claims;
use Wikibase\DataModel\Entity\Entity;
-use Wikibase\DataModel\Entity\EntityId;
use Wikibase\DataModel\Entity\Item;
use Wikibase\DataModel\Entity\ItemId;
use Wikibase\DataModel\Entity\Property;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\DataModel\Snak\PropertyValueSnak;
+use Wikibase\DataModel\Statement\Statement;
use Wikibase\Lib\EntityIdFormatter;
use Wikibase\Lib\EntityIdPlainLinkFormatter;
use Wikibase\Lib\EntityIdValueFormatter;
@@ -86,11 +86,11 @@
}
/**
- * @param EntityId $propertyId
+ * @param PropertyId $propertyId
*
- * @return Entity[]
+ * @return Item[]
*/
- protected function getEntities( EntityId $propertyId ) {
+ protected function getItems( PropertyId $propertyId ) {
$item = new Item();
return array(
@@ -106,17 +106,14 @@
$store = WikibaseRepo::getDefaultInstance()->getEntityStore();
$store->saveEntity( $property, '', $GLOBALS['wgUser'], EDIT_NEW
);
- foreach( $this->getEntities( $property->getId() ) as $entity ) {
- /**
- * @var Claim $claim
- */
- foreach ( $entity->getClaims() as $claim ) {
+ foreach( $this->getItems( $property->getId() ) as $item ) {
+ foreach ( $item->getStatements()->toArray() as
$statement ) {
$value = new StringValue( 'Kittens.png' );
$argLists[] = array(
- 'entity' => $entity,
- 'claimGuid' => $claim->getGuid(),
+ 'entity' => $item,
+ 'claimGuid' => $statement->getGuid(),
'value' => $value->getArrayValue(),
- 'expectedSummary' =>
$this->getExpectedSummary( $claim, $value )
+ 'expectedSummary' =>
$this->getExpectedSummary( $statement, $value )
);
}
}
@@ -211,8 +208,8 @@
);
}
- private function getExpectedSummary( Claim $oldClaim, DataValue $value
= null ) {
- $oldSnak = $oldClaim->getMainSnak();
+ private function getExpectedSummary( Statement $oldStatement, DataValue
$value = null ) {
+ $oldSnak = $oldStatement->getMainSnak();
$property = $this->getEntityIdFormatter()->formatEntityId(
$oldSnak->getPropertyId() );
//NOTE: new snak is always a PropertyValueSnak
--
To view, visit https://gerrit.wikimedia.org/r/208138
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib90121e50a17b5198f818b48f44bd2b80641a6a6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits