/**
  * @param EntityId $id
  *
  * @throws InvalidArgumentException
  * @return Item|Property
  */
 protected function makeEntity(EntityId $id)
 {
     if ($id instanceof ItemId) {
         $entity = new Item($id);
         $entity->getSiteLinkList()->addNewSiteLink('test', 'Foo');
     } elseif ($id instanceof PropertyId) {
         $entity = new Property($id, null, 'wibblywobbly');
     } else {
         throw new InvalidArgumentException('Unsupported entity type ' . $id->getEntityType());
     }
     $entity->setLabel('en', 'label:' . $id->getSerialization());
     return $entity;
 }
 public function testNewFromUpdate_remove()
 {
     $propertyId = new PropertyId('P2');
     $property = new Property($propertyId, null, 'string');
     $property->setLabel('de', 'Katze');
     $factory = $this->getEntityChangeFactory();
     $change = $factory->newFromUpdate(EntityChange::REMOVE, $property, null);
     $this->assertEquals($propertyId, $change->getEntityId(), 'entity id');
     $this->assertEquals('p2', $change->getObjectId(), 'object id');
     $this->assertEquals('wikibase-property~remove', $change->getType(), 'type');
     $this->assertEquals(new Diff(array('de' => new DiffOpRemove('Katze'))), $change->getDiff()->getLabelsDiff(), 'diff');
 }