Henning Snater has uploaded a new change for review.
https://gerrit.wikimedia.org/r/91171
Change subject: Reflect changes to ByPropertyIdArray in Wikibase
......................................................................
Reflect changes to ByPropertyIdArray in Wikibase
(Requires change I5de8cd5e2280bda88cbbf2c351380082e2bb8ff0)
Change-Id: I589d5c8fd1f42503cadbd0ad5148b1aff27795cf
---
M client/includes/parserhooks/PropertyParserFunctionRenderer.php
M lib/includes/serializers/ByPropertyListSerializer.php
M repo/tests/phpunit/includes/api/GetClaimsTest.php
3 files changed, 7 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/71/91171/1
diff --git a/client/includes/parserhooks/PropertyParserFunctionRenderer.php
b/client/includes/parserhooks/PropertyParserFunctionRenderer.php
index 7accf9d..b2a7cc8 100644
--- a/client/includes/parserhooks/PropertyParserFunctionRenderer.php
+++ b/client/includes/parserhooks/PropertyParserFunctionRenderer.php
@@ -83,7 +83,7 @@
}
$allClaims = new Claims( $entity->getClaims() );
- $claims = $allClaims->getClaimsForProperty(
$propertyIdToFind->getNumericId() );
+ $claims = $allClaims->getClaimsForProperty( $propertyIdToFind );
return $claims;
}
diff --git a/lib/includes/serializers/ByPropertyListSerializer.php
b/lib/includes/serializers/ByPropertyListSerializer.php
index b1e057a..d14629a 100644
--- a/lib/includes/serializers/ByPropertyListSerializer.php
+++ b/lib/includes/serializers/ByPropertyListSerializer.php
@@ -4,6 +4,7 @@
use Traversable;
use InvalidArgumentException;
+use Wikibase\ByPropertyIdArray;
use Wikibase\DataModel\Entity\PropertyId;
/**
@@ -87,7 +88,7 @@
$serialization = array();
// FIXME: "iterator => array => iterator" is stupid
- $objects = new \Wikibase\ByPropertyIdArray( iterator_to_array(
$objects ) );
+ $objects = new ByPropertyIdArray( iterator_to_array( $objects )
);
$objects->buildIndex();
foreach ( $objects->getPropertyIds() as $propertyId ) {
@@ -98,8 +99,6 @@
}
$this->setIndexedTagName( $serializedObjects,
$this->elementName );
-
- $propertyId = PropertyId::newFromNumber( $propertyId );
if ( $this->options->shouldIndexTags() ) {
$serializedObjects['id'] =
$propertyId->getPrefixedId();
diff --git a/repo/tests/phpunit/includes/api/GetClaimsTest.php
b/repo/tests/phpunit/includes/api/GetClaimsTest.php
index dbc3a9f..8f7213a 100644
--- a/repo/tests/phpunit/includes/api/GetClaimsTest.php
+++ b/repo/tests/phpunit/includes/api/GetClaimsTest.php
@@ -1,6 +1,8 @@
<?php
namespace Wikibase\Test\Api;
+use Wikibase\ByPropertyIdArray;
+use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\Entity;
use Wikibase\Claim;
use Wikibase\Claims;
@@ -146,17 +148,16 @@
$serializer = $serializerFactory->newSerializerForObject(
$claims );
$expected = $serializer->getSerialized( $claims );
- $byPropClaims = new \Wikibase\ByPropertyIdArray( $claims );
+ $byPropClaims = new ByPropertyIdArray( $claims );
$byPropClaims->buildIndex();
// TODO: this is a rather simplistic test.
// Would be nicer if we could deserialize the list and then use
the equals method
// or to serialize the expected value and have a recursive
array compare on that
foreach ( $expected as $propertyId => $claimsForProperty ) {
- $id = \Wikibase\EntityId::newFromPrefixedId(
$propertyId );
$this->assertEquals(
count( $claimsForProperty ),
- count( $byPropClaims->getByPropertyId(
$id->getNumericId() ) )
+ count( $byPropClaims->getByPropertyId( new
PropertyId( $propertyId ) ) )
);
}
}
--
To view, visit https://gerrit.wikimedia.org/r/91171
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I589d5c8fd1f42503cadbd0ad5148b1aff27795cf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Henning Snater <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits