Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/157654
Change subject: Move DataModelSerializationRoundtripTest to DataModel 1.0 ...................................................................... Move DataModelSerializationRoundtripTest to DataModel 1.0 I'm afraid this does not fix all problems with this test but it's a step in the right direction. Change-Id: Ia55fd99a52d4c6c662c789c08593f0ffe1ac4837 --- M lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php 1 file changed, 19 insertions(+), 16 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/54/157654/1 diff --git a/lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php b/lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php index a465ebf..06807e1 100644 --- a/lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php +++ b/lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php @@ -10,6 +10,7 @@ use DataValues\UnknownValue; use Wikibase\DataModel\Claim\Claim; use Wikibase\DataModel\Claim\Statement; +use Wikibase\DataModel\DeserializerFactory; use Wikibase\DataModel\Entity\BasicEntityIdParser; use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Entity\Item; @@ -18,12 +19,14 @@ use Wikibase\DataModel\Entity\PropertyId; use Wikibase\DataModel\Reference; use Wikibase\DataModel\ReferenceList; +use Wikibase\DataModel\SerializerFactory; use Wikibase\DataModel\SiteLink; use Wikibase\DataModel\Snak\PropertyNoValueSnak; use Wikibase\DataModel\Snak\PropertySomeValueSnak; use Wikibase\DataModel\Snak\PropertyValueSnak; use Wikibase\DataModel\Snak\SnakList; use Wikibase\Lib\Serializers\SerializationOptions; +use Wikibase\Lib\Serializers\SerializerFactory as LegacySerializerFactory; /** * @todo Add tests with $options->setIndexTags( true ). @@ -171,8 +174,8 @@ $item = Item::newEmpty(); $item->setId( new ItemId( 'Q4' ) ); - $this->addClaimsWithoutQualifiers( $item ); - $this->addClaimsWithQualifiers( $item ); + $this->addStatementsWithoutQualifiers( $item ); + $this->addStatementsWithQualifiers( $item ); $this->addStatementsWithRanks( $item ); $this->addStatementsWithQualifiersAndReferences( $item ); $entities[] = $item; @@ -228,22 +231,22 @@ ); } - private function addClaimsWithoutQualifiers( Item $item ) { + private function addStatementsWithoutQualifiers( Item $item ) { foreach ( $this->getSnaks( 'P40' ) as $mainSnak ) { - $claim = new Claim( $mainSnak ); - $this->setGuid( $claim ); - $item->addClaim( $claim ); + $statement = new Statement( $mainSnak ); + $this->setGuid( $statement ); + $item->addClaim( $statement ); } } - private function addClaimsWithQualifiers( Item $item ) { + private function addStatementsWithQualifiers( Item $item ) { $mainSnak = new PropertyNoValueSnak( new PropertyId( 'P501' ) ); $qualifiers = new SnakList( $this->getSnaks( 'P51' ) ); - $claim = new Claim( $mainSnak, $qualifiers ); - $this->setGuid( $claim ); - $item->addClaim( $claim ); + $statement = new Statement( $mainSnak, $qualifiers ); + $this->setGuid( $statement ); + $item->addClaim( $statement ); } private function addStatementsWithRanks( Item $item ) { @@ -275,15 +278,15 @@ $item->addClaim( $statement ); } - private function setGuid( Claim $claim ) { - $claim->setGuid( 'DataModelSerializationRoundtripTest$' . $this->guidCounter ); + private function setGuid( Statement $statement ) { + $statement->setGuid( 'DataModelSerializationRoundtripTest$' . $this->guidCounter ); $this->guidCounter++; } private function getLegacySerializer( Entity $entity ) { $options = new SerializationOptions(); - $legacySerializerFactory = new \Wikibase\Lib\Serializers\SerializerFactory(); + $legacySerializerFactory = new LegacySerializerFactory(); $entityType = $entity->getType(); return $legacySerializerFactory->newSerializerForEntity( $entityType, $options ); } @@ -291,14 +294,14 @@ private function getLegacyUnserializer( Entity $entity ) { $options = new SerializationOptions(); - $legacySerializerFactory = new \Wikibase\Lib\Serializers\SerializerFactory(); + $legacySerializerFactory = new LegacySerializerFactory(); $entityType = $entity->getType(); return $legacySerializerFactory->newUnserializerForEntity( $entityType, $options ); } private function getSerializer() { $dataValueSerializer = new DataValueSerializer(); - $serializerFactory = new \Wikibase\DataModel\SerializerFactory( $dataValueSerializer ); + $serializerFactory = new SerializerFactory( $dataValueSerializer ); return $serializerFactory->newEntitySerializer(); } @@ -309,7 +312,7 @@ 'unknown' => 'DataValues\UnknownValue', ) ); $entityIdParser = new BasicEntityIdParser(); - $deserializerFactory = new \Wikibase\DataModel\DeserializerFactory( $dataValueDeserializer, $entityIdParser ); + $deserializerFactory = new DeserializerFactory( $dataValueDeserializer, $entityIdParser ); return $deserializerFactory->newEntityDeserializer(); } -- To view, visit https://gerrit.wikimedia.org/r/157654 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia55fd99a52d4c6c662c789c08593f0ffe1ac4837 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits