Jeroen De Dauw has submitted this change and it was merged.

Change subject: Replace static Item::newEmpty() with new Item() constructor
......................................................................


Replace static Item::newEmpty() with new Item() constructor

See https://github.com/wmde/WikibaseDataModel/pull/290

Change-Id: I745135f8bd1e21bd3b3e1e44432c00cbf0f03894
---
M client/tests/phpunit/includes/Hooks/OtherProjectsSidebarGeneratorTest.php
M client/tests/phpunit/includes/WikibaseClientTest.php
M client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php
M lib/tests/phpunit/MockRepositoryTest.php
M lib/tests/phpunit/serializers/SerializerFactoryTest.php
M repo/maintenance/importInterlang.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpAliasesTest.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpSiteLinkTest.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpsTest.php
M repo/tests/phpunit/includes/ChangeOp/MergeChangeOpsFactoryTest.php
M repo/tests/phpunit/includes/EditEntityTest.php
M repo/tests/phpunit/includes/ItemMoveTest.php
M repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteJobTest.php
M repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveJobTest.php
M repo/tests/phpunit/includes/Validators/CompositeEntityValidatorTest.php
M repo/tests/phpunit/includes/View/SiteLinksViewTest.php
M repo/tests/phpunit/includes/actions/ActionTestCase.php
M repo/tests/phpunit/includes/api/ApiXmlFormatTest.php
M repo/tests/phpunit/includes/api/CreateClaimTest.php
M repo/tests/phpunit/includes/api/EditEntityTest.php
M repo/tests/phpunit/includes/api/EditPageTest.php
M repo/tests/phpunit/includes/api/GetClaimsTest.php
M repo/tests/phpunit/includes/api/GetEntitiesRedirectTest.php
M repo/tests/phpunit/includes/api/RemoveClaimsTest.php
M repo/tests/phpunit/includes/api/RemoveQualifiersTest.php
M repo/tests/phpunit/includes/api/RemoveReferencesTest.php
M repo/tests/phpunit/includes/api/SetClaimTest.php
M repo/tests/phpunit/includes/api/SetClaimValueTest.php
M repo/tests/phpunit/includes/api/SetQualifierTest.php
M repo/tests/phpunit/includes/api/SetReferenceTest.php
M repo/tests/phpunit/includes/api/SetSiteLinkTest.php
M repo/tests/phpunit/includes/content/EntityContentFactoryTest.php
M repo/tests/phpunit/includes/rdf/RdfBuilderTest.php
M repo/tests/phpunit/includes/specials/SpecialModifyTermTestCase.php
M repo/tests/phpunit/includes/specials/SpecialSetSitelinkTest.php
M repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php
M repo/tests/phpunit/includes/store/sql/EntityPerPageTableTest.php
M repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
M repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php
39 files changed, 89 insertions(+), 89 deletions(-)

Approvals:
  Jeroen De Dauw: Looks good to me, approved



diff --git 
a/client/tests/phpunit/includes/Hooks/OtherProjectsSidebarGeneratorTest.php 
b/client/tests/phpunit/includes/Hooks/OtherProjectsSidebarGeneratorTest.php
index c5a577e..1299a03 100644
--- a/client/tests/phpunit/includes/Hooks/OtherProjectsSidebarGeneratorTest.php
+++ b/client/tests/phpunit/includes/Hooks/OtherProjectsSidebarGeneratorTest.php
@@ -26,7 +26,7 @@
         * @dataProvider projectLinkSidebarProvider
         */
        public function testBuildProjectLinkSidebar( array $siteIdsToOutput, 
array $result ) {
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->addSiteLink( new SiteLink( 'enwiki', 'Nyan Cat' ) );
                $item->addSiteLink( new SiteLink( 'enwiktionary', 'Nyan Cat' ) 
);
 
diff --git a/client/tests/phpunit/includes/WikibaseClientTest.php 
b/client/tests/phpunit/includes/WikibaseClientTest.php
index e992372..1a514d9 100644
--- a/client/tests/phpunit/includes/WikibaseClientTest.php
+++ b/client/tests/phpunit/includes/WikibaseClientTest.php
@@ -182,7 +182,7 @@
                $this->assertInstanceOf( 
'Wikibase\Lib\Store\EntityContentDataCodec', $codec );
 
                $this->setExpectedException( 'RuntimeException' );
-               $codec->encodeEntity( Item::newEmpty(), CONTENT_FORMAT_JSON );
+               $codec->encodeEntity( new Item(), CONTENT_FORMAT_JSON );
        }
 
        public function testGetInternalEntityDeserializer() {
diff --git 
a/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php 
b/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php
index a8b297b..9498e22 100644
--- a/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php
+++ b/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php
@@ -66,7 +66,7 @@
                $statement = new Statement( new Claim( $snak ) );
                $statement->setGuid( 'gsdfgsadg' );
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->addClaim( $statement );
 
                return $item;
@@ -116,7 +116,7 @@
        }
 
        public function testFormatPropertyValuesNoProperty() {
-               $entityLookup = $this->getEntityLookup( Item::newEmpty() );
+               $entityLookup = $this->getEntityLookup( new Item() );
 
                $wikibaseLuaEntityBindings = 
$this->getWikibaseLuaEntityBindings( $entityLookup );
                $ret = $wikibaseLuaEntityBindings->formatPropertyValues( 'Q2', 
'P123456' );
diff --git a/lib/tests/phpunit/MockRepositoryTest.php 
b/lib/tests/phpunit/MockRepositoryTest.php
index 1cd4b11..703d1cc 100644
--- a/lib/tests/phpunit/MockRepositoryTest.php
+++ b/lib/tests/phpunit/MockRepositoryTest.php
@@ -56,7 +56,7 @@
        }
 
        public function testGetEntity() {
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->setLabel( 'en', 'foo' );
 
                // set up a data Item
@@ -94,7 +94,7 @@
        }
 
        public function testGetEntityRevision() {
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->setLabel( 'en', 'foo' );
 
                // set up a data Item
@@ -136,7 +136,7 @@
        }
 
        public function testGetItemIdForLink() {
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->getSiteLinkList()->addNewSiteLink( 'enwiki', 'Foo' );
 
                // test item lookup
@@ -469,7 +469,7 @@
        }
 
        public function provideSaveEntity() {
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->setLabel( 'en', 'one' );
 
                $secondItem = new Item( new ItemId( 'Q1' ) );
@@ -638,7 +638,7 @@
        public function testUpdateWatchlist() {
                $user = User::newFromName( "WikiPageEntityStoreTestUser2" );
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $this->repo->saveEntity( $item, 'testing', $user, EDIT_NEW );
                $itemId = $item->getId();
 
@@ -654,7 +654,7 @@
                $user2 = User::newFromName( 
"WikiPageEntityStoreTestUserWasLastToEdit2" );
 
                // initial revision
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->setLabel( 'en', 'one' );
                $rev1 = $this->repo->saveEntity( $item, 'testing 1', $user1, 
EDIT_NEW );
                $itemId = $item->getId();
diff --git a/lib/tests/phpunit/serializers/SerializerFactoryTest.php 
b/lib/tests/phpunit/serializers/SerializerFactoryTest.php
index 60b985a..0f727ed 100644
--- a/lib/tests/phpunit/serializers/SerializerFactoryTest.php
+++ b/lib/tests/phpunit/serializers/SerializerFactoryTest.php
@@ -35,7 +35,7 @@
                $argLists[] = array( new Reference() );
                $argLists[] = array( new Claim( new PropertyNoValueSnak( 42 ) ) 
);
 
-               $argLists[] = array( Item::newEmpty(), new 
SerializationOptions() );
+               $argLists[] = array( new Item(), new SerializationOptions() );
 
                return $argLists;
        }
diff --git a/repo/maintenance/importInterlang.php 
b/repo/maintenance/importInterlang.php
index df1fe66..4b21e9e 100644
--- a/repo/maintenance/importInterlang.php
+++ b/repo/maintenance/importInterlang.php
@@ -148,7 +148,7 @@
         * @return bool true if the item was created, false otherwise
         */
        private function createItem( array $titles ) {
-               $item = Item::newEmpty();
+               $item = new Item();
                $fingerprint = $item->getFingerprint();
                $siteLinks = $item->getSiteLinkList();
 
diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpAliasesTest.php 
b/repo/tests/phpunit/includes/ChangeOp/ChangeOpAliasesTest.php
index 61b2fbe..110fc5f 100644
--- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpAliasesTest.php
+++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpAliasesTest.php
@@ -125,22 +125,22 @@
         * @param ChangeOpAliases $changeOpAliases
         */
        public function testValidate( ChangeOpAliases $changeOpAliases ) {
-               $entity = Item::newEmpty();
+               $entity = new Item();
 
                $result = $changeOpAliases->validate( $entity );
                $this->assertFalse( $result->isValid() );
        }
 
        public function testValidateLeavesEntityUntouched() {
-               $entity = Item::newEmpty();
+               $entity = new Item();
                $validatorFactory = $this->getTermValidatorFactory();
                $changeOpAliases = new ChangeOpAliases( 'de', array( 'test' ), 
'set', $validatorFactory );
                $changeOpAliases->validate( $entity );
-               $this->assertTrue( $entity->equals( Item::newEmpty() ) );
+               $this->assertTrue( $entity->equals( new Item() ) );
        }
 
        public function testApplyWithInvalidAction() {
-               $entity = Item::newEmpty();
+               $entity = new Item();
                $validatorFactory = $this->getTermValidatorFactory();
 
                $changeOpAliases = new ChangeOpAliases( 'en', array( 'test' ), 
'invalidAction', $validatorFactory );
diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpSiteLinkTest.php 
b/repo/tests/phpunit/includes/ChangeOp/ChangeOpSiteLinkTest.php
index 225917d..bf46ced 100644
--- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpSiteLinkTest.php
+++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpSiteLinkTest.php
@@ -69,7 +69,7 @@
                        $plSiteLink
                );
 
-               $item = Item::newEmpty();
+               $item = new Item();
 
                foreach ( $existingSiteLinks as $siteLink ) {
                        $item->addSiteLink( $siteLink );
@@ -160,7 +160,7 @@
                        $plSiteLink
                );
 
-               $item = Item::newEmpty();
+               $item = new Item();
 
                foreach ( $existingSiteLinks as $siteLink ) {
                        $item->addSiteLink( $siteLink );
@@ -191,7 +191,7 @@
        public function summaryTestProvider() {
                $this->applySettings();
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->getSiteLinkList()->addNewSiteLink( 'dewiki', 'Berlin' );
                $item->getSiteLinkList()->addNewSiteLink( 'ruwiki', 'Берлин', 
array( new ItemId( 'Q42' ) ) );
 
diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpsTest.php 
b/repo/tests/phpunit/includes/ChangeOp/ChangeOpsTest.php
index 0361519..e90ec95 100644
--- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpsTest.php
+++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpsTest.php
@@ -134,7 +134,7 @@
         * @param string $expectedDescription
         */
        public function testApply( $changeOps, $language, $expectedLabel, 
$expectedDescription ) {
-               $entity = Item::newEmpty();
+               $entity = new Item();
 
                $changeOps->apply( $entity );
                $this->assertEquals( $expectedLabel, $entity->getLabel( 
$language ) );
@@ -142,7 +142,7 @@
        }
 
        public function testValidate() {
-               $item = Item::newEmpty();
+               $item = new Item();
 
                $guid = 'guid';
                $snak = new PropertyValueSnak( new PropertyId( 'P7' ), new 
StringValue( 'INVALID' ) );
@@ -167,7 +167,7 @@
        }
 
        public function testValidate_() {
-               $item = Item::newEmpty();
+               $item = new Item();
 
                $changeOp = $this->getMockBuilder( 
'\Wikibase\ChangeOp\ChangeOp' )
                        ->disableOriginalConstructor()
diff --git a/repo/tests/phpunit/includes/ChangeOp/MergeChangeOpsFactoryTest.php 
b/repo/tests/phpunit/includes/ChangeOp/MergeChangeOpsFactoryTest.php
index a612882..0888e59 100644
--- a/repo/tests/phpunit/includes/ChangeOp/MergeChangeOpsFactoryTest.php
+++ b/repo/tests/phpunit/includes/ChangeOp/MergeChangeOpsFactoryTest.php
@@ -49,8 +49,8 @@
        }
 
        public function testNewMergeOps() {
-               $fromItem = Item::newEmpty();
-               $toItem = Item::newEmpty();
+               $fromItem = new Item();
+               $toItem = new Item();
 
                $op = $this->newChangeOpFactory()->newMergeOps( $fromItem, 
$toItem );
                $this->assertInstanceOf( 'Wikibase\ChangeOp\ChangeOpsMerge', 
$op );
diff --git a/repo/tests/phpunit/includes/EditEntityTest.php 
b/repo/tests/phpunit/includes/EditEntityTest.php
index 1349685..02e7e69 100644
--- a/repo/tests/phpunit/includes/EditEntityTest.php
+++ b/repo/tests/phpunit/includes/EditEntityTest.php
@@ -335,7 +335,7 @@
 
                $titleLookup = 
WikibaseRepo::getDefaultInstance()->getEntityTitleLookup();
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->setLabel( 'en', 'omg' );
                $editEntity = $this->makeEditEntity( 
$this->getMockRepository(), $item, $titleLookup );
                $editEntity->attemptSave( "Testing", EDIT_NEW, false );
@@ -364,7 +364,7 @@
                $user = $this->getUser( 'EditEntityTestUser' );
 
                // create item
-               $entity = Item::newEmpty();
+               $entity = new Item();
                $entity->getFingerprint()->setLabel( 'en', 'Test' );
 
                $repo->putEntity( $entity, 0, 0, $user );
@@ -421,7 +421,7 @@
                        $repo,
                        $repo,
                        $this->getEntityPermissionChecker( $permissions ),
-                       Item::newEmpty(),
+                       new Item(),
                        $this->getUser( 'EditEntityTestUser' ),
                        false,
                        $context
@@ -451,7 +451,7 @@
        }
 
        private function prepareItemForPermissionCheck( User $user, 
MockRepository $mockRepository, $create ) {
-               $item = Item::newEmpty();
+               $item = new Item();
 
                if ( $create ) {
                        $item->setLabel( 'de', 'Test' );
@@ -652,7 +652,7 @@
                                $item = $items[$name];
                        } else {
                                // create item
-                               $item = Item::newEmpty();
+                               $item = new Item();
                                $items[$name] = $item;
                        }
 
@@ -694,7 +694,7 @@
                $repo = $this->getMockRepository();
                $user = $this->getUser( 'EditEntityTestUser' );
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $titleLookup = $this->getEntityTitleLookup();
                $edit = $this->makeEditEntity( $repo, $item, $titleLookup, 
$user );
 
@@ -743,7 +743,7 @@
                $user->setOption( 'watchdefault', $watchdefault );
                $user->setOption( 'watchcreations', $watchcreations );
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->setLabel( "en", "Test" );
 
                if ( !$new ) {
diff --git a/repo/tests/phpunit/includes/ItemMoveTest.php 
b/repo/tests/phpunit/includes/ItemMoveTest.php
index 3c44056..9f61c13 100644
--- a/repo/tests/phpunit/includes/ItemMoveTest.php
+++ b/repo/tests/phpunit/includes/ItemMoveTest.php
@@ -60,7 +60,7 @@
 
                $store = WikibaseRepo::getDefaultInstance()->getEntityStore();
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $this->entityRevision = $store->saveEntity( $item, '', 
$GLOBALS['wgUser'], EDIT_NEW );
 
                $id = $this->entityRevision->getEntity()->getId();
diff --git 
a/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteJobTest.php 
b/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteJobTest.php
index 06b36cf..43d5638 100644
--- a/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteJobTest.php
+++ b/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteJobTest.php
@@ -106,7 +106,7 @@
         * @param string $oldTitle
         */
        public function testRun( $expected, $titleExists, $oldTitle ) {
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->getSiteLinkList()->addNewSiteLink( 'enwiki', 'Delete 
me', array( new ItemId( 'Q42' ) ) );
 
                $store = new MockRepository();
diff --git a/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveJobTest.php 
b/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveJobTest.php
index 71528b7..cf44600 100644
--- a/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveJobTest.php
+++ b/repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveJobTest.php
@@ -106,7 +106,7 @@
                // Needed as UpdateRepoOnMoveJob instantiates a User object
                $user->addToDatabase();
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->getSiteLinkList()->addNewSiteLink( 'enwiki', 'Old page 
name', array( new ItemId( 'Q42' ) ) );
 
                $store = new MockRepository();
diff --git 
a/repo/tests/phpunit/includes/Validators/CompositeEntityValidatorTest.php 
b/repo/tests/phpunit/includes/Validators/CompositeEntityValidatorTest.php
index d72cc04..9ed15f9 100644
--- a/repo/tests/phpunit/includes/Validators/CompositeEntityValidatorTest.php
+++ b/repo/tests/phpunit/includes/Validators/CompositeEntityValidatorTest.php
@@ -46,7 +46,7 @@
         * @dataProvider validEntityProvider
         */
        public function testValidateEntity( $validators, $expected ) {
-               $entity = Item::newEmpty();
+               $entity = new Item();
 
                $validator = new CompositeEntityValidator( $validators );
                $result = $validator->validateEntity( $entity );
diff --git a/repo/tests/phpunit/includes/View/SiteLinksViewTest.php 
b/repo/tests/phpunit/includes/View/SiteLinksViewTest.php
index 06d0934..115144b 100644
--- a/repo/tests/phpunit/includes/View/SiteLinksViewTest.php
+++ b/repo/tests/phpunit/includes/View/SiteLinksViewTest.php
@@ -167,7 +167,7 @@
                        false,
                );
 
-               $newItem = Item::newEmpty();
+               $newItem = new Item();
 
                // item with no id, as happens with new items
                $testCases[] = array(
@@ -251,7 +251,7 @@
                        ->method( 'getEntity' )
                        ->will( $this->returnCallback( function( EntityId $id ) 
{
                                if ( $id->getSerialization() === 'Q42' ) {
-                                       $item = Item::newEmpty();
+                                       $item = new Item();
                                        $item->setLabel( 'en', 'Featured 
article' );
                                        return $item;
                                }
diff --git a/repo/tests/phpunit/includes/actions/ActionTestCase.php 
b/repo/tests/phpunit/includes/actions/ActionTestCase.php
index a61cc99..a5c0040 100644
--- a/repo/tests/phpunit/includes/actions/ActionTestCase.php
+++ b/repo/tests/phpunit/includes/actions/ActionTestCase.php
@@ -99,7 +99,7 @@
        private function makeTestItemData() {
                $items = array();
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->setLabel( 'de', 'Berlin' );
                $item->setDescription( 'de', 'Stadt in Deutschland' );
                $items['Berlin'][] = $item;
@@ -115,7 +115,7 @@
                $items['Berlin'][] = $item;
 
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->setLabel( 'en', 'London' );
                $items['London'][] = $item;
 
@@ -124,13 +124,13 @@
                $items['London'][] = $item;
 
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->setLabel( 'de', 'Oslo' );
                $item->setLabel( 'en', 'Oslo' );
                $items['Oslo'][] = $item;
 
                if ( $this->shouldTestRedirects() ) {
-                       $item = Item::newEmpty();
+                       $item = new Item();
                        $item->setLabel( 'de', 'Berlin' );
                        $items['Berlin2'][] = $item;
 
diff --git a/repo/tests/phpunit/includes/api/ApiXmlFormatTest.php 
b/repo/tests/phpunit/includes/api/ApiXmlFormatTest.php
index 84d72ea..ea671b6 100644
--- a/repo/tests/phpunit/includes/api/ApiXmlFormatTest.php
+++ b/repo/tests/phpunit/includes/api/ApiXmlFormatTest.php
@@ -158,7 +158,7 @@
                $entityRevision = $store->saveEntity( $property, 'testing', 
$GLOBALS['wgUser'], EDIT_NEW );
                $propertyId = $entityRevision->getEntity()->getId();
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $entityRevision = $store->saveEntity( $item, 'testing', 
$GLOBALS['wgUser'], EDIT_NEW );
                $item = $entityRevision->getEntity();
 
diff --git a/repo/tests/phpunit/includes/api/CreateClaimTest.php 
b/repo/tests/phpunit/includes/api/CreateClaimTest.php
index d811175..264a77b 100644
--- a/repo/tests/phpunit/includes/api/CreateClaimTest.php
+++ b/repo/tests/phpunit/includes/api/CreateClaimTest.php
@@ -28,7 +28,7 @@
        protected static function getNewItemAndProperty() {
                $store = WikibaseRepo::getDefaultInstance()->getEntityStore();
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $store->saveEntity( $item, 'test', $GLOBALS['wgUser'], EDIT_NEW 
);
 
                $property = Property::newFromType( 'commonsMedia' );
diff --git a/repo/tests/phpunit/includes/api/EditEntityTest.php 
b/repo/tests/phpunit/includes/api/EditEntityTest.php
index e5f4b37..6ac55d0 100644
--- a/repo/tests/phpunit/includes/api/EditEntityTest.php
+++ b/repo/tests/phpunit/includes/api/EditEntityTest.php
@@ -49,15 +49,15 @@
                        $berlinData = EntityTestHelper::getEntityOutput( 
'Berlin' );
                        self::$idMap['%BerlinP56%'] = 
$berlinData['claims'][$p56][0]['id'];
 
-                       $badge = Item::newEmpty();
+                       $badge = new Item();
                        $store->saveEntity( $badge, 'EditEntityTestQ42', 
$GLOBALS['wgUser'], EDIT_NEW );
                        self::$idMap['%Q42%'] = 
$badge->getId()->getSerialization();
 
-                       $badge = Item::newEmpty();
+                       $badge = new Item();
                        $store->saveEntity( $badge, 'EditEntityTestQ149', 
$GLOBALS['wgUser'], EDIT_NEW );
                        self::$idMap['%Q149%'] = 
$badge->getId()->getSerialization();
 
-                       $badge = Item::newEmpty();
+                       $badge = new Item();
                        $store->saveEntity( $badge, 'EditEntityTestQ32', 
$GLOBALS['wgUser'], EDIT_NEW );
                        self::$idMap['%Q32%'] = 
$badge->getId()->getSerialization();
 
diff --git a/repo/tests/phpunit/includes/api/EditPageTest.php 
b/repo/tests/phpunit/includes/api/EditPageTest.php
index 221873b..d478cc1 100644
--- a/repo/tests/phpunit/includes/api/EditPageTest.php
+++ b/repo/tests/phpunit/includes/api/EditPageTest.php
@@ -32,7 +32,7 @@
        public function testEditItemDirectly() {
                $store = WikibaseRepo::getDefaultInstance()->getEntityStore();
 
-               $item = Item::newEmpty(); //@todo: do this with all kinds of 
entities.
+               $item = new Item(); //@todo: do this with all kinds of entities.
                $item->setLabel( "en", "EditPageTest" );
                $store->saveEntity( $item, 'testing', $GLOBALS['wgUser'], 
EDIT_NEW );
 
diff --git a/repo/tests/phpunit/includes/api/GetClaimsTest.php 
b/repo/tests/phpunit/includes/api/GetClaimsTest.php
index 1ffde37..40cc8e5 100644
--- a/repo/tests/phpunit/includes/api/GetClaimsTest.php
+++ b/repo/tests/phpunit/includes/api/GetClaimsTest.php
@@ -85,7 +85,7 @@
 
                $propertyId = $property->getId();
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $this->addStatements( $item, $propertyId );
                $this->save( $item );
 
@@ -221,7 +221,7 @@
         */
        public function testGetInvalidIds( $entity, $property ) {
                if ( !$entity ) {
-                       $item = Item::newEmpty();
+                       $item = new Item();
                        $this->addStatements( $item, new PropertyId( 'P13' ) );
 
                        $this->save( $item );
diff --git a/repo/tests/phpunit/includes/api/GetEntitiesRedirectTest.php 
b/repo/tests/phpunit/includes/api/GetEntitiesRedirectTest.php
index dcde0c7..45847f9 100644
--- a/repo/tests/phpunit/includes/api/GetEntitiesRedirectTest.php
+++ b/repo/tests/phpunit/includes/api/GetEntitiesRedirectTest.php
@@ -24,7 +24,7 @@
 class GetEntitiesRedirectTest extends \ApiTestCase {
 
        private function createEntity( $label ) {
-               $entity = Item::newEmpty();
+               $entity = new Item();
                $entity->setLabel( 'en', $label );
 
                $store = WikibaseRepo::getDefaultInstance()->getEntityStore();
diff --git a/repo/tests/phpunit/includes/api/RemoveClaimsTest.php 
b/repo/tests/phpunit/includes/api/RemoveClaimsTest.php
index 9fb40c7..98cb2ed 100644
--- a/repo/tests/phpunit/includes/api/RemoveClaimsTest.php
+++ b/repo/tests/phpunit/includes/api/RemoveClaimsTest.php
@@ -74,11 +74,11 @@
                $fingerprint = Fingerprint::newEmpty();
                $fingerprint->setLabel( 'en', 'kittens' );
 
-               $nonEmptyItem = Item::newEmpty();
+               $nonEmptyItem = new Item();
                $nonEmptyItem->setFingerprint( $fingerprint );
 
                return array(
-                       $this->addStatementsAndSave( Item::newEmpty() ),
+                       $this->addStatementsAndSave( new Item() ),
                        $this->addStatementsAndSave( $nonEmptyItem ),
                );
        }
diff --git a/repo/tests/phpunit/includes/api/RemoveQualifiersTest.php 
b/repo/tests/phpunit/includes/api/RemoveQualifiersTest.php
index ef64d18..26cc2be 100644
--- a/repo/tests/phpunit/includes/api/RemoveQualifiersTest.php
+++ b/repo/tests/phpunit/includes/api/RemoveQualifiersTest.php
@@ -75,7 +75,7 @@
                $store = WikibaseRepo::getDefaultInstance()->getEntityStore();
 
                foreach ( $this->statementProvider() as $statement ) {
-                       $item = Item::newEmpty();
+                       $item = new Item();
 
                        $store->saveEntity( $item, '', $GLOBALS['wgUser'], 
EDIT_NEW );
 
diff --git a/repo/tests/phpunit/includes/api/RemoveReferencesTest.php 
b/repo/tests/phpunit/includes/api/RemoveReferencesTest.php
index 0a6c375..c06c260 100644
--- a/repo/tests/phpunit/includes/api/RemoveReferencesTest.php
+++ b/repo/tests/phpunit/includes/api/RemoveReferencesTest.php
@@ -74,7 +74,7 @@
 
        public function testRequests() {
                foreach ( $this->statementProvider() as $statement ) {
-                       $item = Item::newEmpty();
+                       $item = new Item();
 
                        $store = 
WikibaseRepo::getDefaultInstance()->getEntityStore();
                        $store->saveEntity( $item, '', $GLOBALS['wgUser'], 
EDIT_NEW );
diff --git a/repo/tests/phpunit/includes/api/SetClaimTest.php 
b/repo/tests/phpunit/includes/api/SetClaimTest.php
index 79079c3..bcf6d62 100644
--- a/repo/tests/phpunit/includes/api/SetClaimTest.php
+++ b/repo/tests/phpunit/includes/api/SetClaimTest.php
@@ -129,7 +129,7 @@
                $statements = $this->getStatements();
 
                foreach ( $statements as $statement ) {
-                       $item = Item::newEmpty();
+                       $item = new Item();
                        $store->saveEntity( $item, 'setclaimtest', 
$GLOBALS['wgUser'], EDIT_NEW );
                        $itemId = $item->getId();
 
@@ -166,7 +166,7 @@
        public function getInvalidCases() {
                $store = WikibaseRepo::getDefaultInstance()->getEntityStore();
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $store->saveEntity( $item, 'setclaimtest', $GLOBALS['wgUser'], 
EDIT_NEW );
                $q17 = $item->getId();
 
@@ -174,7 +174,7 @@
                $store->saveEntity( $property, 'setclaimtest', 
$GLOBALS['wgUser'], EDIT_NEW );
                $p11 = $property->getId();
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $store->saveEntity( $item, 'setclaimtest', $GLOBALS['wgUser'], 
EDIT_NEW );
                $qx = $item->getId();
                $store->deleteEntity( $qx, 'setclaimtest', $GLOBALS['wgUser'] );
@@ -247,7 +247,7 @@
        public function testSetClaimAtIndex() {
                $store = WikibaseRepo::getDefaultInstance()->getEntityStore();
 
-               $item = Item::newEmpty();
+               $item = new Item();
 
                $store->saveEntity( $item, 'setclaimtest', $GLOBALS['wgUser'], 
EDIT_NEW );
                $itemId = $item->getId();
@@ -394,7 +394,7 @@
                $store = WikibaseRepo::getDefaultInstance()->getEntityStore();
 
                // Initialize item content with empty claims:
-               $item = Item::newEmpty();
+               $item = new Item();
                $store->saveEntity( $item, 'setclaimtest', $GLOBALS['wgUser'], 
EDIT_NEW );
 
                // Generate a single claim:
@@ -425,7 +425,7 @@
                $property = $store->saveEntity( $property, '', 
$GLOBALS['wgUser'], EDIT_NEW )->getEntity();
 
                // create item
-               $item = Item::newEmpty();
+               $item = new Item();
                $item = $store->saveEntity( $item, '', $GLOBALS['wgUser'], 
EDIT_NEW )->getEntity();
 
                // add a claim
diff --git a/repo/tests/phpunit/includes/api/SetClaimValueTest.php 
b/repo/tests/phpunit/includes/api/SetClaimValueTest.php
index fc44c74..856924d 100644
--- a/repo/tests/phpunit/includes/api/SetClaimValueTest.php
+++ b/repo/tests/phpunit/includes/api/SetClaimValueTest.php
@@ -89,7 +89,7 @@
         * @return Entity[]
         */
        protected function getEntities( EntityId $propertyId ) {
-               $item = Item::newEmpty();
+               $item = new Item();
 
                return array(
                        $this->addStatementsAndSave( $item, $propertyId ),
diff --git a/repo/tests/phpunit/includes/api/SetQualifierTest.php 
b/repo/tests/phpunit/includes/api/SetQualifierTest.php
index 3b5840c..b9b3fd1 100644
--- a/repo/tests/phpunit/includes/api/SetQualifierTest.php
+++ b/repo/tests/phpunit/includes/api/SetQualifierTest.php
@@ -90,7 +90,7 @@
                if ( !$item ) {
                        $store = 
WikibaseRepo::getDefaultInstance()->getEntityStore();
 
-                       $newItem = Item::newEmpty();
+                       $newItem = new Item();
                        $store->saveEntity( $newItem, '', $GLOBALS['wgUser'], 
EDIT_NEW );
 
                        $prop = Property::newFromType( 'string' );
diff --git a/repo/tests/phpunit/includes/api/SetReferenceTest.php 
b/repo/tests/phpunit/includes/api/SetReferenceTest.php
index 8da6823..a196cd3 100644
--- a/repo/tests/phpunit/includes/api/SetReferenceTest.php
+++ b/repo/tests/phpunit/includes/api/SetReferenceTest.php
@@ -67,7 +67,7 @@
        public function testRequests() {
                $store = WikibaseRepo::getDefaultInstance()->getEntityStore();
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $store->saveEntity( $item, '', $GLOBALS['wgUser'], EDIT_NEW );
 
                $statement = new Statement( new Claim( new PropertyNoValueSnak( 
self::$propertyIds[0] ) ) );
@@ -135,7 +135,7 @@
        public function testRequestWithInvalidProperty() {
                $store = WikibaseRepo::getDefaultInstance()->getEntityStore();
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $store->saveEntity( $item, '', $GLOBALS['wgUser'], EDIT_NEW );
 
                // Create a statement to act upon:
@@ -157,7 +157,7 @@
        public function testSettingIndex() {
                $store = WikibaseRepo::getDefaultInstance()->getEntityStore();
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $store->saveEntity( $item, '', $GLOBALS['wgUser'], EDIT_NEW );
 
                // Create a statement to act upon:
diff --git a/repo/tests/phpunit/includes/api/SetSiteLinkTest.php 
b/repo/tests/phpunit/includes/api/SetSiteLinkTest.php
index dc88355..7b6ca74 100644
--- a/repo/tests/phpunit/includes/api/SetSiteLinkTest.php
+++ b/repo/tests/phpunit/includes/api/SetSiteLinkTest.php
@@ -145,15 +145,15 @@
 
                        $this->initTestEntities( array( 'StringProp', 
'Leipzig', 'Berlin' ) );
 
-                       $badge = Item::newEmpty();
+                       $badge = new Item();
                        $store->saveEntity( $badge, 'SetSiteLinkTestGA', 
$GLOBALS['wgUser'], EDIT_NEW );
                        self::$gaItemId = $badge->getId();
 
-                       $badge = Item::newEmpty();
+                       $badge = new Item();
                        $store->saveEntity( $badge, 'SetSiteLinkTestFA', 
$GLOBALS['wgUser'], EDIT_NEW );
                        self::$faItemId = $badge->getId();
 
-                       $badge = Item::newEmpty();
+                       $badge = new Item();
                        $store->saveEntity( $badge, 'SetSiteLinkTestOther', 
$GLOBALS['wgUser'], EDIT_NEW );
                        self::$otherItemId = $badge->getId();
 
diff --git a/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php 
b/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php
index 46ff737..2e5ab08 100644
--- a/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php
+++ b/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php
@@ -220,7 +220,7 @@
        public function testGetPermissionStatusForEntity( $action, 
$permissions, $id, $expectations ) {
                global $wgUser;
 
-               $entity = Item::newEmpty();
+               $entity = new Item();
 
                if ( $id ) {
                        // "exists"
@@ -258,7 +258,7 @@
        }
 
        public function newFromEntityProvider() {
-               $item = Item::newEmpty();
+               $item = new Item();
                $property = Property::newFromType( 'string' );
 
                return array(
diff --git a/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php 
b/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php
index 4e1b4ba..ef6ea08 100644
--- a/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php
+++ b/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php
@@ -41,11 +41,11 @@
                        return $entities;
                }
 
-               $entity = Item::newEmpty();
+               $entity = new Item();
                $entities['empty'] = $entity;
 
 
-               $entity = Item::newEmpty();
+               $entity = new Item();
                $entities['terms'] = $entity;
                $entity->setFingerprint( self::newTestFingerprint() );
 
diff --git a/repo/tests/phpunit/includes/specials/SpecialModifyTermTestCase.php 
b/repo/tests/phpunit/includes/specials/SpecialModifyTermTestCase.php
index d7df613..4fde09f 100644
--- a/repo/tests/phpunit/includes/specials/SpecialModifyTermTestCase.php
+++ b/repo/tests/phpunit/includes/specials/SpecialModifyTermTestCase.php
@@ -22,7 +22,7 @@
         * @return string
         */
        private function createNewItem() {
-               $item = Item::newEmpty();
+               $item = new Item();
                // add data and check if it is shown in the form
                $item->setLabel( 'de', 'foo' );
                $item->setDescription( 'de', 'foo' );
diff --git a/repo/tests/phpunit/includes/specials/SpecialSetSitelinkTest.php 
b/repo/tests/phpunit/includes/specials/SpecialSetSitelinkTest.php
index eda2f06..f7a5346 100644
--- a/repo/tests/phpunit/includes/specials/SpecialSetSitelinkTest.php
+++ b/repo/tests/phpunit/includes/specials/SpecialSetSitelinkTest.php
@@ -109,11 +109,11 @@
        private function createItems() {
                $store = WikibaseRepo::getDefaultInstance()->getEntityStore();
 
-               $badge = Item::newEmpty();
+               $badge = new Item();
                $badge->setLabel( 'en', 'Good article' );
                $store->saveEntity( $badge, "testing", $GLOBALS['wgUser'], 
EDIT_NEW );
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->addSiteLink( new SiteLink( 'dewiki', 'Wikidata', array( 
$badge->getId() ) ) );
                $store->saveEntity( $item, "testing", $GLOBALS['wgUser'], 
EDIT_NEW );
 
diff --git a/repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php 
b/repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php
index e93b408..f0bb862 100644
--- a/repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php
+++ b/repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php
@@ -107,7 +107,7 @@
                $store = WikibaseRepo::getDefaultInstance()->getEntityStore();
 
                foreach( $labels as $label ) {
-                       $item = Item::newEmpty();
+                       $item = new Item();
                        $item->setLabel( 'en', $prefix . $label );
                        $rev = $store->saveEntity( $item, "added an item", 
$user, EDIT_NEW );
                        $items[] = $rev->getEntity();
@@ -115,7 +115,7 @@
 
                if ( $this->itemSupportsRedirect() ) {
                        // add another berlin (so we have a valid id), then 
turn it into a redirect
-                       $item = Item::newEmpty();
+                       $item = new Item();
                        $item->setLabel( 'en', $prefix . 'Berlin2' );
                        $rev = $store->saveEntity( $item, "added an item", 
$user, EDIT_NEW );
                        $items[] = $rev->getEntity();
diff --git a/repo/tests/phpunit/includes/store/sql/EntityPerPageTableTest.php 
b/repo/tests/phpunit/includes/store/sql/EntityPerPageTableTest.php
index 2918538..673bcff 100644
--- a/repo/tests/phpunit/includes/store/sql/EntityPerPageTableTest.php
+++ b/repo/tests/phpunit/includes/store/sql/EntityPerPageTableTest.php
@@ -136,7 +136,7 @@
 
        public function listEntitiesProvider() {
                $property = Property::newFromType( 'string' );
-               $item = Item::newEmpty();
+               $item = new Item();
 
                return array(
                        'empty' => array(
@@ -155,7 +155,7 @@
        }
 
        public function testGetPageIdForEntityId() {
-               $entity = Item::newEmpty();
+               $entity = new Item();
 
                $epp = $this->newEntityPerPageTable( array( $entity ) );
                $entityId = $entity->getId();
@@ -172,8 +172,8 @@
                        $this->markTestSkipped( 'Redirects not supported' );
                }
 
-               $entity = Item::newEmpty();
-               $entity2 = Item::newEmpty();
+               $entity = new Item();
+               $entity2 = new Item();
 
                $epp = $this->newEntityPerPageTable( array( $entity, $entity2 ) 
);
                $redirectId = $entity->getId();
diff --git a/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php 
b/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
index ad3d4f8..5eaa848 100644
--- a/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
+++ b/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
@@ -402,7 +402,7 @@
 
                return array(
                        array( $expectedTerms, $item ),
-                       array( array(), Item::newEmpty() ),
+                       array( array(), new Item() ),
                        array( array(), $this->getMock( 
'Wikibase\DataModel\Entity\EntityDocument' ) )
                );
        }
diff --git a/repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php 
b/repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php
index 230e45b..ed72d43 100644
--- a/repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php
+++ b/repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php
@@ -86,7 +86,7 @@
        }
 
        private function getSimpleEntities() {
-               $item = Item::newEmpty();
+               $item = new Item();
                $item->setLabel( 'en', 'Item' );
                $item->setDescription( 'en', 'Item description' );
 
@@ -158,7 +158,7 @@
        }
 
        public function provideSaveEntityError() {
-               $firstItem = Item::newEmpty();
+               $firstItem = new Item();
                $firstItem->setLabel( 'en', 'one' );
 
                $secondItem = new Item( new ItemId( 'Q768476834' ) );
@@ -191,7 +191,7 @@
                $user = $GLOBALS['wgUser'];
 
                // setup target item
-               $one = Item::newEmpty();
+               $one = new Item();
                $one->setLabel( 'en', 'one' );
                $r1 = $store->saveEntity( $one, 'create one', $user, EDIT_NEW );
 
@@ -237,7 +237,7 @@
                $store->registerWatcher( $watcher );
 
                // create one
-               $one = Item::newEmpty();
+               $one = new Item();
                $one->setLabel( 'en', 'one' );
 
                $r1 = $store->saveEntity( $one, 'create one', $user, EDIT_NEW );
@@ -304,7 +304,7 @@
                $anonUser = User::newFromId(0);
                $anonUser->setName( '127.0.0.1' );
                $user = User::newFromName( "EditEntityTestUser" );
-               $item = Item::newEmpty();
+               $item = new Item();
 
                // check for default values, last revision by anon 
--------------------
                $item->setLabel( 'en', "Test Anon default" );
@@ -364,7 +364,7 @@
                        $user->addToDatabase();
                }
 
-               $item = Item::newEmpty();
+               $item = new Item();
                $store->saveEntity( $item, 'testing', $user, EDIT_NEW );
 
                $itemId = $item->getId();
@@ -377,7 +377,7 @@
        }
 
        protected function newEntity() {
-               $item = Item::newEmpty();
+               $item = new Item();
                return $item;
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I745135f8bd1e21bd3b3e1e44432c00cbf0f03894
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to