@@ -260,6 +260,78 @@ 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 ->find (Card::class, $ card ->id );
305
+
306
+ $ this ->_em ->getUnitOfWork ()->recomputeSingleEntityChangeSet (
307
+ $ this ->_em ->getClassMetadata (Card::class),
308
+ $ result
309
+ );
310
+
311
+ self ::assertFalse ($ this ->_em ->getUnitOfWork ()->isScheduledForUpdate ($ result ));
312
+ }
313
+
314
+ public function testEnumArraySingleEntityChangeSets (): void
315
+ {
316
+ $ this ->setUpEntitySchema ([Scale::class]);
317
+
318
+ $ scale = new Scale ();
319
+ $ scale ->supportedUnits = [Unit::Gram];
320
+
321
+ $ this ->_em ->persist ($ scale );
322
+ $ this ->_em ->flush ();
323
+ $ this ->_em ->clear ();
324
+
325
+ $ result = $ this ->_em ->find (Scale::class, $ scale ->id );
326
+
327
+ $ this ->_em ->getUnitOfWork ()->recomputeSingleEntityChangeSet (
328
+ $ this ->_em ->getClassMetadata (Scale::class),
329
+ $ result
330
+ );
331
+
332
+ self ::assertFalse ($ this ->_em ->getUnitOfWork ()->isScheduledForUpdate ($ result ));
333
+ }
334
+
263
335
public function testEnumChangeSetsSimpleObjectHydrator (): void
264
336
{
265
337
$ this ->setUpEntitySchema ([Card::class]);
0 commit comments