Skip to content

Commit e750360

Browse files
authored
Merge pull request #10101 from greg0ire/followup-9488
Assert that serialization leaves PersistentCollection usable
2 parents e8ac116 + dd8c700 commit e750360

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/Doctrine/Tests/ORM/PersistentCollectionTest.php

+11
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
use function array_keys;
2222
use function assert;
2323
use function method_exists;
24+
use function serialize;
25+
use function unserialize;
2426

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

287289
$this->collection->clear();
288290
}
291+
292+
public function testItCanBeSerializedAndUnserializedBack(): void
293+
{
294+
$this->collection->add(new stdClass());
295+
$collection = unserialize(serialize($this->collection));
296+
$collection->add(new stdClass());
297+
$collection[3] = new stdClass();
298+
self::assertCount(3, $collection);
299+
}
289300
}

0 commit comments

Comments
 (0)