jenkins-bot has submitted this change and it was merged.

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, 40 insertions(+), 0 deletions(-)

Approvals:
  Daniel Kinzler: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/tests/phpunit/changes/EntityChangeTest.php 
b/lib/tests/phpunit/changes/EntityChangeTest.php
index 2aa8bd9..ce8ca1c 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,42 @@
                $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();
+
+               if ( !defined( 'WB_VERSION' ) ) {
+                       $this->setExpectedException( 'RuntimeException' );
+               }
+
+               $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: merged
Gerrit-Change-Id: I6a8ab6be1bd50ba70226a8d19f017137c1b19272
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>
Gerrit-Reviewer: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de>
Gerrit-Reviewer: Hoo man <h...@online.de>
Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to