Skip to content

Commit

Permalink
Assert that serialization leaves PersistentCollection usable
Browse files Browse the repository at this point in the history
That feature is no longer covered since support for merging entities in
the entity manager was removed.
  • Loading branch information
greg0ire committed Oct 6, 2022
1 parent 9bec416 commit dd8c700
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 dd8c700

Please sign in to comment.