Skip to content

Commit 35520de

Browse files
committed
Revert to use non-deprecated Item::copy and Property::copy
1 parent b70d447 commit 35520de

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

tests/unit/Entity/EntityTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ public function testCopyRetainsLabels() {
377377
$item->getFingerprint()->setLabel( 'en', 'foo' );
378378
$item->getFingerprint()->setLabel( 'de', 'bar' );
379379

380-
$newItem = unserialize( serialize( $item ) );
380+
$newItem = $item->copy();
381381

382382
$this->assertTrue( $newItem->getFingerprint()->getLabels()->hasTermForLanguage( 'en' ) );
383383
$this->assertTrue( $newItem->getFingerprint()->getLabels()->hasTermForLanguage( 'de' ) );

tests/unit/Entity/ItemTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,10 @@ public function equalsProvider() {
344344
$secondItem = new Item();
345345
$secondItem->getStatements()->addNewStatement( new PropertyNoValueSnak( 42 ) );
346346

347-
$secondItemWithId = unserialize( serialize( $secondItem ) );
347+
$secondItemWithId = $secondItem->copy();
348348
$secondItemWithId->setId( 42 );
349349

350-
$differentId = unserialize( serialize( $secondItemWithId ) );
350+
$differentId = $secondItemWithId->copy();
351351
$differentId->setId( 43 );
352352

353353
return array(

tests/unit/Entity/PropertyTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ public function equalsProvider() {
158158
$secondProperty = Property::newFromType( 'string' );
159159
$secondProperty->setStatements( $this->newNonEmptyStatementList() );
160160

161-
$secondPropertyWithId = unserialize( serialize( $secondProperty ) );
161+
$secondPropertyWithId = $secondProperty->copy();
162162
$secondPropertyWithId->setId( 42 );
163163

164-
$differentId = unserialize( serialize( $secondPropertyWithId ) );
164+
$differentId = $secondPropertyWithId->copy();
165165
$differentId->setId( 43 );
166166

167167
return array(

0 commit comments

Comments
 (0)