66
77use Doctrine \Common \Collections \ArrayCollection ;
88use Doctrine \Common \Collections \Collection ;
9- use Doctrine \ODM \MongoDB \Id \UuidGenerator ;
109use Doctrine \ODM \MongoDB \Mapping \Annotations as ODM ;
1110use Doctrine \ODM \MongoDB \Tests \BaseTestCase ;
1211
12+ use function bin2hex ;
13+ use function random_bytes ;
14+
1315class GH1525Test extends BaseTestCase
1416{
1517 public function testEmbedCloneTwoFlushesPerDocument (): void
@@ -46,12 +48,11 @@ public function testEmbedCloneTwoFlushesPerDocument(): void
4648
4749 public function testEmbedCloneWithIdStrategyNoneOnParentAndEarlyPersist (): void
4850 {
49- $ uuidGen = new UuidGenerator ();
5051 $ embedded = new GH1525Embedded ('embedded ' );
5152
5253 $ count = 2 ;
5354 for ($ i = 0 ; $ i < $ count ; ++$ i ) {
54- $ parent = new GH1525DocumentIdStrategyNone ($ uuidGen -> generateV4 ( ), 'test ' . $ i );
55+ $ parent = new GH1525DocumentIdStrategyNone (bin2hex ( random_bytes ( 6 ) ), 'test ' . $ i );
5556 $ this ->dm ->persist ($ parent );
5657 $ parent ->embedded = $ embedded ;
5758 $ this ->dm ->flush ();
@@ -71,12 +72,11 @@ public function testEmbedCloneWithIdStrategyNoneOnParentAndEarlyPersist(): void
7172
7273 public function testEmbedCloneWithIdStrategyNoneOnParentAndLatePersist (): void
7374 {
74- $ uuidGen = new UuidGenerator ();
7575 $ embedded = new GH1525Embedded ('embedded ' );
7676
7777 $ count = 2 ;
7878 for ($ i = 0 ; $ i < $ count ; ++$ i ) {
79- $ parent = new GH1525DocumentIdStrategyNone ($ uuidGen -> generateV4 ( ), 'test ' . $ i );
79+ $ parent = new GH1525DocumentIdStrategyNone (bin2hex ( random_bytes ( 6 ) ), 'test ' . $ i );
8080 $ parent ->embedded = $ embedded ;
8181 $ this ->dm ->persist ($ parent );
8282 $ this ->dm ->flush ();
0 commit comments