Skip to content

Commit 662d7fc

Browse files
committed
Merge pull request #518 from wmde/remove-copy
Remove Entity::copy
2 parents 4e8281d + f11da70 commit 662d7fc

4 files changed

Lines changed: 7 additions & 39 deletions

File tree

RELEASE-NOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Wikibase DataModel release notes
22

3+
## Version 5.0 (dev)
4+
5+
#### Breaking changes
6+
7+
* Removed `Entity::copy`
8+
39
## Version 4.0 (2015-07-28)
410

511
#### Breaking changes

src/Entity/Entity.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -324,18 +324,6 @@ public function setAllAliases( array $aliasLists ) {
324324
}
325325
}
326326

327-
/**
328-
* Returns a deep copy of the entity.
329-
*
330-
* @since 0.1
331-
* @deprecated since 1.0
332-
*
333-
* @return self
334-
*/
335-
public function copy() {
336-
return unserialize( serialize( $this ) );
337-
}
338-
339327
/**
340328
* @since 0.3
341329
* @deprecated since 1.0, use getStatements()->toArray() instead.

tests/unit/Entity/EntityTest.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -360,32 +360,6 @@ public function instanceProvider() {
360360
return $argLists;
361361
}
362362

363-
/**
364-
* @dataProvider instanceProvider
365-
* @param Entity $entity
366-
*/
367-
public function testCopy( Entity $entity ) {
368-
$copy = $entity->copy();
369-
370-
// The equality method alone is not enough since it does not check the IDs.
371-
$this->assertTrue( $entity->equals( $copy ) );
372-
$this->assertEquals( $entity->getId(), $copy->getId() );
373-
374-
$this->assertFalse( $entity === $copy );
375-
}
376-
377-
public function testCopyRetainsLabels() {
378-
$item = new Item();
379-
380-
$item->getFingerprint()->setLabel( 'en', 'foo' );
381-
$item->getFingerprint()->setLabel( 'de', 'bar' );
382-
383-
$newItem = unserialize( serialize( $item ) );
384-
385-
$this->assertTrue( $newItem->getFingerprint()->getLabels()->hasTermForLanguage( 'en' ) );
386-
$this->assertTrue( $newItem->getFingerprint()->getLabels()->hasTermForLanguage( 'de' ) );
387-
}
388-
389363
/**
390364
* @dataProvider instanceProvider
391365
* @param Entity $entity

tests/unit/Entity/ItemTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function itemProvider() {
8080
$items[] = $item;
8181

8282
/** @var Item $item */
83-
$item = $item->copy();
83+
$item = unserialize( serialize( $item ) );
8484
$item->getStatements()->addNewStatement(
8585
new PropertyNoValueSnak( new PropertyId( 'P42' ) )
8686
);

0 commit comments

Comments
 (0)