Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/252900

Change subject: Add missing arrayalize/objectify tests to EntityChangeTest
......................................................................

Add missing arrayalize/objectify tests to EntityChangeTest

This also covers code in the abstract base class.

More methods in these two classes are uncovered, but I did not wanted
to make this patch to complicated.

Change-Id: I6a8ab6be1bd50ba70226a8d19f017137c1b19272
---
M lib/tests/phpunit/changes/EntityChangeTest.php
1 file changed, 35 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/00/252900/1

diff --git a/lib/tests/phpunit/changes/EntityChangeTest.php 
b/lib/tests/phpunit/changes/EntityChangeTest.php
index 2aa8bd9..ba4424a 100644
--- a/lib/tests/phpunit/changes/EntityChangeTest.php
+++ b/lib/tests/phpunit/changes/EntityChangeTest.php
@@ -9,6 +9,8 @@
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
+use Wikibase\DataModel\Snak\PropertyNoValueSnak;
+use Wikibase\DataModel\Statement\Statement;
 use Wikibase\EntityChange;
 use Wikibase\ItemContent;
 
@@ -290,4 +292,37 @@
                $this->assertEquals( $timestamp, $change->getTime() );
        }
 
+       public function testArrayalizeObjects() {
+               $statement = new Statement( new PropertyNoValueSnak( 1 ) );
+               $expected = array(
+                       'mainsnak' => array(
+                               'snaktype' => 'novalue',
+                               'property' => 'P1',
+                               'hash' => 
'2d7ef41c913ec99eb249645e154e77670090db68',
+                       ),
+                       'type' => 'statement',
+                       'rank' => 'normal',
+                       '_claimclass_' => 
'Wikibase\DataModel\Statement\Statement',
+               );
+
+               $change = new EntityChange();
+               $array = $change->arrayalizeObjects( $statement );
+               $this->assertSame( $expected, $array );
+       }
+
+       public function testObjectifyArrays() {
+               $data = array(
+                       'mainsnak' => array(
+                               'snaktype' => 'novalue',
+                               'property' => 'P1',
+                       ),
+                       'type' => 'statement',
+                       '_claimclass_' => 
'Wikibase\DataModel\Statement\Statement',
+               );
+
+               $change = new EntityChange();
+               $statement = $change->objectifyArrays( $data );
+               $this->assertInstanceOf( 
'Wikibase\DataModel\Statement\Statement', $statement );
+       }
+
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/252900
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a8ab6be1bd50ba70226a8d19f017137c1b19272
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

Reply via email to