@@ -260,6 +260,86 @@ public function testEnumArrayInDtoHydration(): void
260
260
self ::assertEqualsCanonicalizing ([Unit::Gram, Unit::Meter], $ result [0 ]->supportedUnits );
261
261
}
262
262
263
+ public function testEnumSingleEntityChangeSetsSimpleObjectHydrator (): void
264
+ {
265
+ $ this ->setUpEntitySchema ([Card::class]);
266
+
267
+ $ card = new Card ();
268
+ $ card ->suit = Suit::Clubs;
269
+
270
+ $ this ->_em ->persist ($ card );
271
+ $ this ->_em ->flush ();
272
+ $ this ->_em ->clear ();
273
+
274
+ $ result = $ this ->_em ->find (Card::class, $ card ->id );
275
+
276
+ $ this ->_em ->getUnitOfWork ()->recomputeSingleEntityChangeSet (
277
+ $ this ->_em ->getClassMetadata (Card::class),
278
+ $ result
279
+ );
280
+
281
+ self ::assertFalse ($ this ->_em ->getUnitOfWork ()->isScheduledForUpdate ($ result ));
282
+
283
+ $ result ->suit = Suit::Hearts;
284
+
285
+ $ this ->_em ->getUnitOfWork ()->recomputeSingleEntityChangeSet (
286
+ $ this ->_em ->getClassMetadata (Card::class),
287
+ $ result
288
+ );
289
+
290
+ self ::assertTrue ($ this ->_em ->getUnitOfWork ()->isScheduledForUpdate ($ result ));
291
+ }
292
+
293
+ public function testEnumSingleEntityChangeSetsObjectHydrator (): void
294
+ {
295
+ $ this ->setUpEntitySchema ([Card::class]);
296
+
297
+ $ card = new Card ();
298
+ $ card ->suit = Suit::Clubs;
299
+
300
+ $ this ->_em ->persist ($ card );
301
+ $ this ->_em ->flush ();
302
+ $ this ->_em ->clear ();
303
+
304
+ $ result = $ this ->_em ->createQueryBuilder ()
305
+ ->from (Card::class, 'c ' )
306
+ ->select ('c ' )
307
+ ->getQuery ()
308
+ ->getResult ();
309
+
310
+ $ this ->_em ->getUnitOfWork ()->recomputeSingleEntityChangeSet (
311
+ $ this ->_em ->getClassMetadata (Card::class),
312
+ $ result [0 ]
313
+ );
314
+
315
+ self ::assertFalse ($ this ->_em ->getUnitOfWork ()->isScheduledForUpdate ($ result [0 ]));
316
+ }
317
+
318
+ public function testEnumArraySingeEntityChangeSets (): void
319
+ {
320
+ $ this ->setUpEntitySchema ([Scale::class]);
321
+
322
+ $ scale = new Scale ();
323
+ $ scale ->supportedUnits = [Unit::Gram];
324
+
325
+ $ this ->_em ->persist ($ scale );
326
+ $ this ->_em ->flush ();
327
+ $ this ->_em ->clear ();
328
+
329
+ $ result = $ this ->_em ->createQueryBuilder ()
330
+ ->from (Scale::class, 's ' )
331
+ ->select ('s ' )
332
+ ->getQuery ()
333
+ ->getResult ();
334
+
335
+ $ this ->_em ->getUnitOfWork ()->recomputeSingleEntityChangeSet (
336
+ $ this ->_em ->getClassMetadata (Card::class),
337
+ $ result [0 ]
338
+ );
339
+
340
+ self ::assertFalse ($ this ->_em ->getUnitOfWork ()->isScheduledForUpdate ($ result [0 ]));
341
+ }
342
+
263
343
public function testEnumChangeSetsSimpleObjectHydrator (): void
264
344
{
265
345
$ this ->setUpEntitySchema ([Card::class]);
0 commit comments