Skip to content

Commit

Permalink
Merge pull request #10101 from greg0ire/followup-9488
Browse files Browse the repository at this point in the history
Assert that serialization leaves PersistentCollection usable
  • Loading branch information
greg0ire committed Oct 7, 2022
2 parents e8ac116 + dd8c700 commit e750360
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/Doctrine/Tests/ORM/PersistentCollectionTest.php
Expand Up @@ -21,6 +21,8 @@
use function array_keys;
use function assert;
use function method_exists;
use function serialize;
use function unserialize;

/**
* Tests the lazy-loading capabilities of the PersistentCollection and the initialization of collections.
Expand Down Expand Up @@ -286,4 +288,13 @@ public function testModifyUOWForDeferredImplicitOwnerOnClear(): void

$this->collection->clear();
}

public function testItCanBeSerializedAndUnserializedBack(): void
{
$this->collection->add(new stdClass());
$collection = unserialize(serialize($this->collection));
$collection->add(new stdClass());
$collection[3] = new stdClass();
self::assertCount(3, $collection);
}
}

0 comments on commit e750360

Please sign in to comment.